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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.