How to inject JS code when browser's button is clicked? I noticed that RegisterStartupScript during that page life cycle doesn't inject any JS code.
OR
How to force any browser to not use the cache and do a fresh complete page load when back button is used?
您可以检查引荐网址(通过Request对象或HTTP Server变量)以查看它是否来自Page Load事件中的特定页面,然后从那里加载您的JavaScript。
I think that depends on what you have that is being cached... for example, in a project I had IE caching images, and no matter if you pressed the back button or refresh the page, the image won't be refreshed. So the solution was to add a querystring to the img source with a timestamp.
Hope it helps.
Try adding the following line to the Page Load event. The page will not be cached and will be reloaded, not retreived from the cache.
Response.Cache.SetCacheability(HttpCacheability.NoCache);
我认为您希望将HttpCachePolicy设置如下:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.