Reputation: 6603
Purpose : For Google Ads
I need to reload a page without loading js content ( which will be in file) as JS will be bigger in size it will get loaded only for first time and for next page reloads only dynamic content ( like ads , dynamic text) will keep on changing. Is there a way to do this ?
Upvotes: 2
Views: 517
Reputation: 68
Or you can refresh dynamic content using Ajax
http://www.markvoss.net/scripts/ajax.asp
That's an option
Upvotes: 1
Reputation: 188
If on Linux you can use the .htaccess file e.g:
See:
This works great.
Mathias
Upvotes: 6
Reputation: 1334
Most browsers cache JavaScript and CSS files as long as the name of the file hasn't changed since last time the page was accessed.
Also, if file size is an issue, consider minifying your JS and CSS files. This compresses the files using various techniques while keeping the same functionality. There are various online tools for doing this, my favorite being Online YUI Compressor.
Upvotes: 7
Reputation: 328594
There are two ways:
You can make sure that the JS file can be cached by sending the appropriate HTTP headers to the browser.
If users stay a long time on your site and work with it like a desktop app, you can create an initial page and load the JS once. If you convert all links to send AJAX requests which just replace the content part of the page, the JS won't be loaded again because you never "leave" the page.
Upvotes: 2