简体   繁体   中英

Javascript history.go

保存项目后,我需要给用户一个警报。因此,我正在使用打开脚本来显示此警报。但是,当我从该页面移出并通过history.go(-1)返回时,再次获得警报。如何确保仅当我保存项目时才发出此警报?

If you use history,go(-1) then you are going to the page that saved the record, so it will be saving the record again.

It might work with history.go(-2) if you came from the page that shows the result, but it might not update with the saved record because the page is cached. Go on to the page that shows the result, instead of trying to find it in the history.

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