Jump to content

cross-domain javascript interaction


ohdang888

Recommended Posts

By default browser's don't allow cross-domain JavaScript.  I forget how, but there is a way that is supported by the JavaScript language to allow cross-domain scripting.

 

It could also be the case that you install JavaScript on your page that talks to a page on your domain and behind the scenes this page talks to Google or whoever.

+ You embed ad in your page with JavaScript attached

+ User clicks ad, JavaScript talks to ad.php on your domain.

+ ad.php then sends web service request behind the scenes to a third party.

What do you mean not safe? It's not even possible. However, you can call a JavaScript file that works as a PHP file. ;)

 

how do you do that? thanks!

 

It could also be the case that you install JavaScript on your page that talks to a page on your domain and behind the scenes this page talks to Google or whoever.

well google analytical doesn't put a file on your site yet it still interacts with another server with javascript

It's not even possible.

From my recollection, it is possible but both domains have to collaborate with each other.  I believe I read how to do this in O'Reilly's Complete JavaScript Reference.

 

http://jszen.blogspot.com/2005/03/cross-domain-security-woes.html

It's not even possible.

From my recollection, it is possible but both domains have to collaborate with each other.  I believe I read how to do this in O'Reilly's Complete JavaScript Reference.

 

http://jszen.blogspot.com/2005/03/cross-domain-security-woes.html

It's also possible with a workaround called jsonp(json with padding). Your serverside script does have to give the output in a certain way. Twitter offers this service so thats how I found out about it.Have a look on the following articles for more info.

http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/

http://en.wikipedia.org/wiki/JSON#JSONP

http://docs.jquery.com/Release:jQuery_1.2/Ajax#Cross-Domain_getJSON_.28using_JSONP.29

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.