SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    reload iframe that is inserted unobtrusively

    If you have a script that creates an iframe, unobtrusively, like the following example. And it links to a specific page, like page2.html, that page loads in immediately, like it should.

    But what if you want to reload the page in this external created iframe afterwards, for example when clicking on a link or another event, that the iframe loads page3.html or some other page, with a reload or redirect?. How do you do that?

    Because I can't seem to get acces to this frame or it's behaviour if it is pushed in my html from external manners this way. If it was already in the html page, it's easier I think but this is not the case.

    Any help?

    Code:
    <head>
    <script type="text/javascript">
       window.onload = function(){
          var od = document.getElementById('originalDiv');
          od.innerHTML += "<iframe src='page2.html'></iframe>";			
    }
    </script>
    </head>
    <body>
    <div id="originalDiv"></div>
    </body>
    Thanks

  2. #2
    SitePoint Addict
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I already see what the problem is.
    It has to do with domain names. I can't link to another website.

    But if I open a page from my own domain that redirects to that other website, it works.
    So that domain policy is quite easy to workaround?.... Or is there another solution so I can link just immediately?


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
  •