unframe bust

Discussion in 'Javascript' started by Bob Feather, May 10, 2004.

  1. Bob Feather

    Bob Feather Guest

    I am designing a frameset that will display other web site's pages in one of
    my frames, and I have encountered the following code in a few web pages.

    <script language="Javascript">
    if (top.location != self.location)
    {
    top.location = self.location.href
    }
    </script>

    This code reloads top.location with the other websites url and wipes out my
    entire frameset. Is there anyway to prevent this script in the other web
    site's html from NOT wiping out my frameset in both Netscape & IE browsers?

    Thanks.
    Bob Feather, May 10, 2004
    #1
    1. Advertising

  2. "Bob Feather" <> writes:

    > I am designing a frameset that will display other web site's pages in one of
    > my frames,


    Do you have the permission of the author of the other page? If you
    make your page public, you could easily be charged with copyright
    infringment for creating a derivative work.

    > and I have encountered the following code in a few web pages.
    >
    > <script language="Javascript">
    > if (top.location != self.location)
    > {
    > top.location = self.location.href
    > }
    > </script>


    Obviously people who don't want their page framed. I guess you'll have
    to live with that. There is no way to avoid this in a general browser.

    For Netscape or Mozilla, you could probably trigger on the reading of
    top.location (which is in your page) and cause an error that stops
    execution before the assignment. I don't think IE has anything similar
    to that.

    /L
    --
    Lasse Reichstein Nielsen -
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
    'Faith without judgement merely degrades the spirit divine.'
    Lasse Reichstein Nielsen, May 10, 2004
    #2
    1. Advertising

  3. Bob Feather

    kaeli Guest

    In article <_TNnc.108858$>,
    enlightened us with...
    >
    > This code reloads top.location with the other websites url and wipes out my
    > entire frameset. Is there anyway to prevent this script in the other web
    > site's html from NOT wiping out my frameset in both Netscape & IE browsers?
    >



    No. We put that there so people like you can't frame our sites when we
    don't want you to.

    --
    --
    ~kaeli~
    The secret of the universe is @*&^^^ NO CARRIER
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
    kaeli, May 10, 2004
    #3
  4. Bob Feather

    Matt Kruse Guest

    kaeli wrote:
    > No. We put that there so people like you can't frame our sites when we
    > don't want you to.


    Which is pretty idiotic and annoying, IMO.
    My personal home page for my browser is a local file that contains a number
    of frames of sites which I visit often.

    If a site kicks me out of my frameset (which is obnoxious behavior, imo)
    then I try not to use that site anymore. Or to put that site into my
    restricted zone, so no javascript will run (which sometimes makes the site
    break anyway!)

    To me, it's on the same level as trying to popup a new full-screen window.
    Don't do it. Let the user access your site in the way which is most
    convenient to them.

    --
    Matt Kruse
    Javascript Toolbox: http://www.mattkruse.com/javascript/
    Matt Kruse, May 10, 2004
    #4
  5. Bob Feather

    Matt Kruse Guest

    Lasse Reichstein Nielsen wrote:
    > Do you have the permission of the author of the other page? If you
    > make your page public, you could easily be charged with copyright
    > infringment for creating a derivative work.


    Is there a precedent for this?

    > Obviously people who don't want their page framed. I guess you'll have
    > to live with that. There is no way to avoid this in a general browser.


    Other than turning off javascript for the domain which you want to stay
    framed.

    --
    Matt Kruse
    Javascript Toolbox: http://www.mattkruse.com/javascript/
    Matt Kruse, May 10, 2004
    #5
  6. Bob Feather

    kaeli Guest

    In article <>,
    enlightened us with...
    > kaeli wrote:
    > > No. We put that there so people like you can't frame our sites when we
    > > don't want you to.

    >
    > Which is pretty idiotic and annoying, IMO.


    It's also irritating (and possibly illegal) to have my business site
    framed in someone else's business site as though it's their content.
    Sorry.
    No one's coding for you to take their stuff and let it work outside its
    normal context. Any already framed site could easily break when they try
    to reference top.frames, too.

    > My personal home page for my browser is a local file that contains a number
    > of frames of sites which I visit often.


    We care about non-personal use. Sorry, I can't make code that checks if
    it's on your desktop or someone else's site stealing my stuff.

    Do you try to play Playstation games on an Xbox, too?

    --
    --
    ~kaeli~
    The secret of the universe is @*&^^^ NO CARRIER
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
    kaeli, May 10, 2004
    #6
  7. Bob Feather

    Matt Kruse Guest

    kaeli wrote:
    > It's also irritating (and possibly illegal) to have my business site
    > framed in someone else's business site as though it's their content.


    Legal problems should be solved in a legal way.

    > No one's coding for you to take their stuff and let it work outside
    > its normal context. Any already framed site could easily break when
    > they try to reference top.frames, too.


    But in most cases, referencing top.anything is not good. Relative references
    are always preferred when possible.
    IMO, a page should only care about itself and its parent. No further. So
    "top" is rarely necessary.

    > Do you try to play Playstation games on an Xbox, too?


    heh, who has time for games? :)

    --
    Matt Kruse
    Javascript Toolbox: http://www.mattkruse.com/javascript/
    Matt Kruse, May 10, 2004
    #7
  8. Bob Feather

    Csaba Gabor Guest

    "Matt Kruse" <> wrote in message
    news:...
    > Lasse Reichstein Nielsen wrote:
    > > Do you have the permission of the author of the other page? If you
    > > make your page public, you could easily be charged with copyright
    > > infringment for creating a derivative work.

    >
    > Is there a precedent for this?


    All I can think of right now is hotmail. If you see a link in hotmail,
    Microsoft is tracking you when you click on it (you haven't left
    hotmail - look at the url you get). And anywhere you go to from
    there is within their frame.

    Csaba Gabor

    > > Obviously people who don't want their page framed. I guess you'll have
    > > to live with that. There is no way to avoid this in a general browser.

    >
    > Other than turning off javascript for the domain which you want to stay
    > framed.
    >
    > --
    > Matt Kruse
    > Javascript Toolbox: http://www.mattkruse.com/javascript/
    Csaba Gabor, May 12, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Howard

    python a bust?

    John Howard, Nov 14, 2003, in forum: Python
    Replies:
    57
    Views:
    1,307
    Michael Hudson
    Dec 16, 2003
  2. Michael Sparks
    Replies:
    6
    Views:
    470
    Michael Sparks
    Sep 21, 2005
  3. Jp Calderone
    Replies:
    1
    Views:
    379
    Michael Sparks
    Sep 20, 2005
  4. RichB
    Replies:
    4
    Views:
    382
    RichB
    Oct 3, 2008
  5. zalun
    Replies:
    2
    Views:
    87
    zalun
    Mar 24, 2006
Loading...

Share This Page