M
matt
I get this error: Error: uncaught exception: Permission denied to call
method XMLHttpRequest.open
I think I need to sign my script, but not sure if what I want to do
will even work.
So let me explain.
I have a datafeed on my site www.mysite.com
for simplicity it is a php page with only <?PHP echo "Hello"; ?>
I have a .js file on www.mysite.com that reads the php file.
CODE:
-----------------------------------------------------------------
var xmlHttp
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
xmlHttp=new XMLHttpRequest();
xmlHttp.onreadystatechange = stateChanged;
xmlHttp.open("Get", "http://www.mysite.com/Get_News.php")
xmlHttp.send(null)
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("output").innerHTML=xmlHttp.responseText
}
}
function GetXmlHttpObject(handler)
{
var objXmlHttp=null
if (navigator.userAgent.indexOf("Opera")>=0)
{
alert("This example doesn't work in Opera")
return
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{
var strName="Msxml2.XMLHTTP"
if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.XMLHTTP"
}
try
{
objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler
return objXmlHttp
}
catch(e)
{
alert("Error. Scripting for ActiveX might be disabled")
return
}
}
if (navigator.userAgent.indexOf("Mozilla")>=0)
{
objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler
return objXmlHttp
}
}
--------------------------------------------------------------------------
I want other people to be able to just add a <script> to their site
that accesses my .js file and output the data to their site.
here is the sample of of the script:
<script src="http://www.mysite.com/ajax_notify.js"
type="text/javascript"></script>
<div id="output"></DIV>
Is this possible? To allow the public to access a js file on my server
to read my data and display on their site?
If I do need to sign the javescript, how do I do that?
method XMLHttpRequest.open
I think I need to sign my script, but not sure if what I want to do
will even work.
So let me explain.
I have a datafeed on my site www.mysite.com
for simplicity it is a php page with only <?PHP echo "Hello"; ?>
I have a .js file on www.mysite.com that reads the php file.
CODE:
-----------------------------------------------------------------
var xmlHttp
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
xmlHttp=new XMLHttpRequest();
xmlHttp.onreadystatechange = stateChanged;
xmlHttp.open("Get", "http://www.mysite.com/Get_News.php")
xmlHttp.send(null)
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("output").innerHTML=xmlHttp.responseText
}
}
function GetXmlHttpObject(handler)
{
var objXmlHttp=null
if (navigator.userAgent.indexOf("Opera")>=0)
{
alert("This example doesn't work in Opera")
return
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{
var strName="Msxml2.XMLHTTP"
if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.XMLHTTP"
}
try
{
objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler
return objXmlHttp
}
catch(e)
{
alert("Error. Scripting for ActiveX might be disabled")
return
}
}
if (navigator.userAgent.indexOf("Mozilla")>=0)
{
objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler
return objXmlHttp
}
}
--------------------------------------------------------------------------
I want other people to be able to just add a <script> to their site
that accesses my .js file and output the data to their site.
here is the sample of of the script:
<script src="http://www.mysite.com/ajax_notify.js"
type="text/javascript"></script>
<div id="output"></DIV>
Is this possible? To allow the public to access a js file on my server
to read my data and display on their site?
If I do need to sign the javescript, how do I do that?