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 4 of 4
  1. #1
    DMN
    DMN is offline
    New Coder
    Join Date
    Dec 2012
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Web Page Opens in New Window not Iframe

    Hi All,
    I don't know if this is the right forum to ask my question but I'm going to anyway. One of my pages uses an iframe to open a website when the page loads. I have tested the iframe to see if all website will open in the iframe as soon as the page loads by inserting different URLs into the src attribute of the iframe tag. To my surprise, some sites open in a new window while others open inside of the iframe like they're supposed to. Then out of curiosity I tried disabling javascript and then refreshing my browser. I've found that every page displays inside of the iframe like they were supposed to, including the ones that used to open in a new window. So my question is how do I make every website display inside of my iframe without disabling javascript? Thanks in advance for your reply.
    Last edited by DMN; 03-11-2013 at 01:32 AM.

  • #2
    New Coder
    Join Date
    Mar 2013
    Posts
    63
    Thanks
    2
    Thanked 2 Times in 2 Posts
    this sounds like you need to set the target to open in the said frame

    <a target=""></a>

    _blank
    Opens the linked document in a new window or tab
    _self
    Opens the linked document in the same frame as it was clicked (this is default)
    _parent
    Opens the linked document in the parent frame
    _top
    Opens the linked document in the full body of the window
    framename
    Opens the linked document in a named frame

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,455
    Thanks
    0
    Thanked 632 Times in 622 Posts
    Quote Originally Posted by DMN View Post
    So my question is how do I make every website display inside of my iframe without disabling javascript? Thanks in advance for your reply.
    Some pages have JavaScript attached that prevents them from being opened inside of someone else's frames. The script basically says that if the page isn't the only thing in the browser then to reload the page so it fills the browser. You can also use server side code that does similar that can't be bypassed by turning off JavaScript.

    Where someone's site uses JavaScript to make sure it doesn't display in frames then you should not attempt to bypass that as basically that is denying you permission to make use of their page like that.
    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.

  • #4
    New Coder
    Join Date
    Mar 2013
    Posts
    63
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by felgall View Post
    Some pages have JavaScript attached that prevents them from being opened inside of someone else's frames. The script basically says that if the page isn't the only thing in the browser then to reload the page so it fills the browser. You can also use server side code that does similar that can't be bypassed by turning off JavaScript.

    Where someone's site uses JavaScript to make sure it doesn't display in frames then you should not attempt to bypass that as basically that is denying you permission to make use of their page like that.

    so is there any way to achieve this? I honestly didn't know about this.


  •  

    Posting Permissions

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