Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Blocked iframe one domain to another domain

    Hi all,

    I have a frame in my google gadget and have global variable i written.so i would like to access this in localserver html page. for this i am getting blocked iframe from http://.. to https://... so i tried using
    var o = document.getElementById('video');// here i am unable to get iframe object as bloked iframe its giving error
    o.contentWindow.postMessage("hello",'http://localhost:');

    iframe declared as
    <iframe src = 'https://localhost:8080/index.html'> this in google gadget xml page.

    Please help me on this and one more thing this iframe is loading in onlly chrome not in firefox, ie8 also.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,074
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Have you heard about Same-origin policy?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Quote Originally Posted by jyothsna View Post
    here i am unable to get iframe object as bloked iframe its giving error
    o.contentWindow.postMessage("hello",'http://localhost:');
    To be able to communicate between the domains using postMessage the JavaScript needs to be attached to the page within the frame to handle that side of the processing and to the page outside the frame for the other half.

    You can't have all the JavaScript attached to the one page as the script in that page has no access to anything in the other page except for any messages sent from the other page.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

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