homepage Welcome to WebmasterWorld Guest from 54.166.14.218
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

    
What does this JavaScript do?
Marcia

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



 
Msg#: 27 posted 9:09 pm on Jan 2, 2002 (gmt 0)

<script language="JavaScript">
<!--
// re-establish frame context
if (top == self) self.location.href = "/index.html";
//-->
</script>

 

bobriggs

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 27 posted 9:11 pm on Jan 2, 2002 (gmt 0)

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.

Marcia

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



 
Msg#: 27 posted 9:33 pm on Jan 2, 2002 (gmt 0)

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?

hasbeen

10+ Year Member



 
Msg#: 27 posted 9:50 pm on Jan 2, 2002 (gmt 0)

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.

tedster

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



 
Msg#: 27 posted 10:01 pm on Jan 2, 2002 (gmt 0)

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.

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