Welcome to WebmasterWorld Guest from 54.159.96.99

Forum Moderators: open

Message Too Old, No Replies

What does this JavaScript do?

     
9:09 pm on Jan 2, 2002 (gmt 0)

WebmasterWorld Senior Member marcia is a WebmasterWorld Top Contributor of All Time 10+ Year Member



<script language="JavaScript">
<!--
// re-establish frame context
if (top == self) self.location.href = "/index.html";
//-->
</script>
9:11 pm on Jan 2, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If the frame is by itself (it's probably an inner frame and has become the top window), the JS loads index.html which in turn will load the framed page that the script is located on.

or without being longwinded: Just loads the frameset page.

9:33 pm on Jan 2, 2002 (gmt 0)

WebmasterWorld Senior Member marcia is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I have no conception whether this is spiderable. Yes a whole site loads in a frame. I don't even know whether a site like this can be optimized. I'm still laboring under the apparently mistaken impression that websites are supposed to be HTML. Why does it take JavaScript to get pages to load? I've done a frames site, it loads just fine with HTML. What am I missing?
9:50 pm on Jan 2, 2002 (gmt 0)

10+ Year Member



That javascript you mention will re-load the entire frameset if one of the internal frames is linked from somewhere else.

For example if your left frame=nav.html and your right frame=content.html. If someone (e.g. a search engine) only spiders content.html and displays it under a relavent search string, the javascript will reload both nav.html AND content.html in their proper context rather than simply supplying you with content.html.

Hope that answers it and doesn't just rehash something you already understand.

10:01 pm on Jan 2, 2002 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



The javascript above unfortunately loads only one particular frameset -- the intial condition with only the first pages showing in each frame. If someone links into a "deeper" frameset, through a search engine or another link, they won't get the relevant page they hoped for.

On the generic javascript [webmasterworld.com] thread, there's some code near the bottom called "Force Many Pages Into Frames" which handles that problem. With Google and others indexing orphaned content pages, this can be a very useful tool for a framed site.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month