[Javascript] disabling <target=_top> in frame pages

Chris Basken chriz at basken.com
Thu May 17 08:52:36 CDT 2001


well, just to play devil's advocate, you probably could cycle through the
document.link array and check the .target property.  theoretically, you
should be able to sweep for '_top' and change it to '_self', or something (a
la
http://developer.netscape.com/docs/manuals/js/client/jsref/link.htm#1193137)

but, as Bob says, it's dishonest to do that if the framed page isn't yours
or given to you.

so, as a countermeasure for anyone worried about such things, you can always
put something like this in your page, to prevent someone from framing it:

<body onLoad="if (parent.frames){location.replace('myrealpage.html')}">

someone confirm the syntax on that, i'm writing it off the top of my head.
basically, checking to see if there's a parent frameset, and if true,
redirecting the user to a page of my choice.  using location.replace is a
good kick too, since the user won't be able to use the back button to go to
the thieving page.

now, don't ask about the logical counter-countermeasure here -- checking the
body tag for onLoad events...  8)

(wow, it's like a web cold war!)


-----Original Message-----
From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
Behalf Of Filipiak, Bob (Contractor)
Sent: Thursday, May 17, 2001 9:10 AM
To: 'javascript at LaTech.edu'
Subject: RE: [Javascript] disabling <target=_top> in frame pages


There was a major law suit and IIRC there was an expensive settlement and
Microsoft had to take the link down.

Bob Filipiak (Contractor)
MCP
-----Original Message-----
From: Andrew Gibson [mailto:andyg at ihug.co.nz]
Sent: Thursday, May 17, 2001 8:47 AM
To: javascript at LaTech.edu
Subject: RE: [Javascript] disabling <target=_top> in frame pages


>>Suggest you do some research on what happened with Microsoft nestling
TicketMaster in their pages.

Ok, Bob, we'll bite....spill the beans, what happened???
-----Original Message-----
From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
Behalf Of Filipiak, Bob (Contractor)
Sent: Friday, May 18, 2001 12:15 AM
To: 'javascript at LaTech.edu'
Subject: RE: [Javascript] disabling <target=_top> in frame pages


Short answer no. People use the function to keep their pages out of your
frames so it doesn't look like their pages are your work. If you really want
to put  someone else's pages in your frameset ask them for a copy. Suggest
you do some research on what happened with Microsoft nestling TicketMaster
in their pages.

Bob Filipiak (Contractor)
MCP
-----Original Message-----
From: john [mailto:john at indeco.net.au]
Sent: Thursday, May 17, 2001 7:58 AM
To: javascript at LaTech.edu
Subject: [Javascript] disabling <target=_top> in frame pages


Hi everybody,
does anybody know of any script that can be used in a frame page,
that would render the command <target=_top> inoperative if it is written in
any of the
pages loaded in the windows of the frame.

thanks already, lovely to see such a bunch of little helpers ;-))





More information about the Javascript mailing list