On Mar 1, 2004, at 17:44, Allan Crossman wrote:
Is there a way to prevent abominations like www.powerpedia.org, which put Wikipedia in a frame with their own adverts? While that particular site is probably not very important, I can see this becoming more of an issue. Would it be possible for Wikipedia pages to use that lovely bit of Javascript so common nowadays, which automatically breaks out of frames?
Yuck! Okay, I've added a quick anti-frames check. (You may have to reload to get wikibits.js to update.)
if( window.top != window ) window.top.location = window.location;
It works in the following browsers I tested: Safari 1.2/Mac Konqueror 3.2.0/Unix Firefox 0.8/Win Mozilla 1.2/Mac MSIE 6.0/Win Opera 6/Mac Opera 7.23/Win Netscape 4.77/Mac Netscape 3.04/Win
For some reason it doesn't work in MSIE 5.2/Mac: it gives a "Permission denied" error, and doesn't break out of the frameset. It doesn't give the error on a regular page view, just when trying to escape frames.
It looks something like:
<script language="JavaScript"> <!-- function SymError() { return true; } window.onerror = SymError; var SymRealWinOpen = window.open; function SymWinOpen(url, name, attributes) { return (new Object()); } window.open = SymWinOpen; //--> </script>
<body onload="var SymTmpWinOpen = window.open; window.open = SymWinOpen; delayedreload(); window.open = SymTmpWinOpen;">
This looks like it's meant to prevent embedded scripts from opening popup windows.
-- brion vibber (brion @ pobox.com)