Results 1 to 4 of 4

Thread: If domain is different how to call the function from iframe

  1. #1
    Join Date
    Oct 2008
    Posts
    40
    Thanks
    3
    Thanked 1 Time in 1 Post

    Smile If domain is different how to call the function from iframe

    hello,

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

    Thanks is advanced.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    No modern browser allows this.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    pankaj.ghadge (01-06-2009)

  4. #3
    Join Date
    Oct 2008
    Posts
    40
    Thanks
    3
    Thanked 1 Time in 1 Post

    Smile

    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.

  5. #4
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    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:

    Code:
    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •