2

I have a html page that doesn't change too much and I want to cache it for one week for ex. In this html I have some JS scripts that does some ajax requests and modifies the html. When the browser loads this page, does the JS scripts run?

10x

4

2 回答 2

2

Yea, it does.
JavaScript is always executed on page load, cached or not.

Unless you're postponing the JS with a onload handler, of course, then it's executed after the page's loaded.

于 2013-01-03T14:09:21.017 回答
1

Yes, JS code runs each time the page is loaded. As well, you can use onLoad event on body tag or jQuery event $(docuemnt).load(...).

于 2013-01-03T14:14:59.213 回答