PDA

View Full Version : If domain is different how to call the function from iframe



pankaj.ghadge
01-06-2009, 07:53 AM
hello,

How to call the javascript function to and from the iframe if the domain is different .

Thanks is advanced.

jscheuer1
01-06-2009, 12:00 PM
No modern browser allows this.

pankaj.ghadge
01-06-2009, 01:09 PM
Is it possible to call function via ajax if the domain is different.?
if possible please tell me.

1)how to call the java script function from php.
2)how to specify the full path of url in ajax.

codeexploiter
01-07-2009, 09:13 AM
1) The execution of a JS function is always in the browser as far as the client-side script is concerned. So at the moment your PHP code executes it will not execute the JS code (client-side).

2) You can use something like the following to obtain the domain name:


var domain = 'http://' + document.domain;
var fullpath = domain + "your_folder/your_resource_name";

You can replace the 'your_folder' with your original folder structure also the 'your_resource_name' with your correct resource which you want to access from the server-side