简体   繁体   中英

javascript:history.back() triggers postback on machine, but not when precompiled

On my machine when I test my webapplication (wether in debug or normal) after a javascript:history.back() triggers a postback in my app. On the other hand it does not occur when i precompile the application. Lastly, when I test the same pages on someones elses machine, the postback does not occur at all.

I'm using vs2008, asp.net 2.0 with AutoEventWireup="false"

I checked files with beyond compare, checked metadata.xml but I don't understand why on my local it does a postback.

what can be the problem?

do it like: javascript:history.back(); return false;

On the other hand it does not occur when i precompile the application. Lastly, when I test the same pages on someones elses machine, the postback does not occur at all.

Then it's likely a cacheing issue. If IE can remember the previous page it may not have to reload it. Different deployment options lead to different cacheing headers being passed back to the browser, and different browser options may conspire to expire the cache at different points.

In general you want to be using the Post/Redirect/Get pattern to avoid postbacks, and there is almost never a good reason to use 'history.back()' or 'javascript:' URLs.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM