Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Thanked 0 Times in 0 Posts

    Open page on a div outside iframe


    I have a link/button in a html page which is in iframe and this iframe is on main page.
    On main page i have a div "id=centerPanelContainer".

    Requirement: On click of link/button the html page should show outside iframe and inside that div "id=centerPanelContainer"

    I tried below code but its not working. the page still opening within iframe.

    function load_home() {
    document.getElementById("content").innerHTML='<object type="text/html" data="test.html" ></object>';
    <div> <a href ="#" onclick="load_home()">Create Form</a> </div>
    <div id ="content">TTTTTTTTTTTTTTTTTTTTTTTT</div>

  2. #2
    Senior Coder deathshadow's Avatar
    Join Date
    Feb 2016
    Keene, NH
    Thanked 483 Times in 471 Posts
    Not sure exactly what you're trying to accomplish, but the mix of JavaScript and IFRAME (and object acting like an IFRAME)...

    1) is probably being blocked without declaring a cross-site origin policy exception.

    2) should probably REMAIN blocked due to security issues.

    3) probably is neither JavaScript nor IFRAME's job.

    I'd have to see more to say more. IFRAME (and by extension OBJECT) is a cute toy for embedding advertisements or off-side media like youtube videos. Using them for anything else is almost always an epic /FAIL/ at web development and flipping the bird at accessibility norms.

    JUST like scripting anchor behaviors with no scripting off fallbacks. It's a really good way to tell visitors to the site to sod off, or in some industries even land yourself with court time and possible fines.
    “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies.” – C.A.R. Hoare, The 1980 ACM Turing Award Lecture

  3. #3
    Senior Coder
    Join Date
    Aug 2010
    Thanked 278 Times in 276 Posts
    this works for me
    i ran it on my desktop
    maybe your url is wrong ?

    function load_home() {
    document.getElementById("content").innerHTML='<object type="text/html" data="http://www.example.com" ></object>';
    <div> <a href ="#" onclick="load_home()">Create Form</a> </div>
    <div id ="content">TTTTTTTTTTTTTTTTTTTTTTTT</div>
    Last edited by DaveyErwin; Apr 15th, 2019 at 09:36 PM.


Tags for this Thread

Posting Permissions

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