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

    
How to load JS code for future pages in advance?
stivare

5+ Year Member



 
Msg#: 3975194 posted 7:32 pm on Aug 19, 2009 (gmt 0)

Hi,

I have three web pages that use javascript.

page 1 - Very light in size with a basic form. Very little form validation and cookie setting JS code here.
page 2 - Very high amount of JS code depending on cookies set and form fields on previous page. There can be a lot of user interaction.
page 3 - Very high amount of JS code used to work with HTML and CSS.

Now, since page-1 is very light in size, I want to download some of the JS code used on page-2, when user lands on page-1. I want to put it in browser cache and use it when user reaches page-2.
Page-2 has a lot of interaction, and user is expected to be on this page for some time. I want to use this idle internet connection time to download the JS code for page-3.

Is this possible to do?

Thanks
Su

 

whoisgregg

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



 
Msg#: 3975194 posted 7:47 pm on Aug 19, 2009 (gmt 0)

You can't do this with inline scripts, but you can do it if each one is it's own external javascript file.

Just include the external scripts and make sure those files send the right caching headers. :)

stivare

5+ Year Member



 
Msg#: 3975194 posted 8:01 pm on Aug 20, 2009 (gmt 0)

Thanks.... That works

Su

whoisgregg

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



 
Msg#: 3975194 posted 7:07 pm on Aug 22, 2009 (gmt 0)

No problem Su, glad it worked out for you. :)

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