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 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    San Francisco, CA
    Thanked 0 Times in 0 Posts

    [Sovled]link targeting iframe opens new window in IE6+7

    The solution:
    Found my own answer.
    var frame = document.createElement('div');
    frame.innerHTML = '<iframe id="frame_1" name="frame_1" src="/assets/blank.html"></iframe>';

    This frame registers fine in IE6+7

    For reference....

    The problem:


    Here's my problem. I have a JavaScript produced iframe on a page. When I click a link targeting that iframe in IE6+7 It opens a new window. The expected functionality is to load the link page in the iframe.

    Here's the JavaScript:

    //create iframe
    var frame = document.createElement('iframe'); //create the iframe
    frame.setAttribute('id', 'frame_2'); //set id
    frame.setAttribute('name', 'frame_2'); //set name
    document.body.appendChild(frame); //append to body

    //create link
    var a = document.createElement('a'); //create the link
    a.setAttribute('href', '/assets/blank.html'); //set href
    a.setAttribute('target', 'frame_2'); //set target
    a.innerHTML = 'Click this in IE6 or IE7'; //set message
    document.body.appendChild(a); //append to body

    Here's the implementation: http://js.openovate.com/assets/iframe.html

    Any help or corrections would be appreciated.
    Last edited by cblanquera; 03-12-2009 at 03:05 AM. Reason: Solved


Posting Permissions

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