homepage Welcome to WebmasterWorld Guest from 54.211.95.201
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
is this a js frame buster?
nancyb




msg:1480981
 5:56 pm on Jan 9, 2003 (gmt 0)

I'm using this in all my pages and am having some problems seeing the page when it is redirected from an se and when trying to see the page from wusage report referrers.

<script TYPE="text/javascript">
if(top.location!= document.location)
top.location = document.location;
</script>

have I screwed up the code or will I see these problems because I'm using this?

Thanks

<added> I'm using it in the head section </added>

 

jdMorgan




msg:1480982
 7:02 pm on Jan 9, 2003 (gmt 0)

nancyb,

I had a similar problem, especially when framed by Lycos's "Fast Forward" feature. The frame-escape would often leave "broken" html fragments on the page.

I fixed it by moving the frame buster to the bottom of the page. Since the page is already (usually) cached, it the reload isn't usually disuptive.

Here's the code I was using:

<script language="JavaScript1.1" type="text/JavaScript"> <!--
if (parent.frames.length > 0) top.location.replace(document.location); // Escape from frame, but retain one-click "Back". -->
</script>
</body>
</html>

I'd love to hear some better suggestions - I got it working and forgot about it, but it's rather inelegant.

Jim

nancyb




msg:1480983
 7:38 pm on Jan 9, 2003 (gmt 0)

Thanks, Jim. In-elegant or not, I'll change mine, too, especially since I wouldn't have a clue that it ever was inelegant :)

jdMorgan




msg:1480984
 7:58 pm on Jan 9, 2003 (gmt 0)

nancyb,

What I meant was that moving my code to the bottom of the page where it will force a reload (but usually from the browser cache) was inelegant - I certainly meant no disrespect to your code. Moving the frame-buster fixed the problem I was seeing, but forced the entire page to be reloaded - so I considered it a "band-aid" fix.

Earnestly awaiting more opinions...

Jim

nancyb




msg:1480985
 8:05 pm on Jan 9, 2003 (gmt 0)

Jim,

Oh, goodness, I was not clear. I did not think you were refering to my code! I was "trying" to be humerous about your comment of inelegant. I know nothing about js. But, thanks for the clarification on how it would cause a reload.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved