By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,667 Members | 2,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,667 IT Pros & Developers. It's quick & easy.

How can I allow people access to my datafeed with javascript

P: n/a
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=xmlHtt p.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?

Jun 16 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

An example of what I want to do is similar to google adwords:

<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

Jun 16 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.