简体   繁体   English

转到上一个html页面而不刷新数据

[英]Go to previous html page without refreshing the data

Am using onLoad function of html page to fetch the data from server and to update the table rows with angularJS ng-repeat. 我使用html页面的onLoad函数从服务器获取数据并使用angularJS ng-repeat更新表行。 Whenever I go to another html page and returns back, onload function is executing and it causes a delay. 每当我转到另一个html页面并返回时,onload函数正在执行并导致延迟。 I need to return to the previous html page without refreshing the data. 我需要返回上一个html页面而不刷新数据。

You've got a couple of options -- the best one tends to be saving a flag inside of a window.sessionStorage and storing the data there as well. 你有几个选择 - 最好的选择是在window.sessionStorage存储一个标志,并存储数据。

Note that sessionStorage is unique to each window/tab and is temporary, unlike localStorage which is more long term. 请注意, sessionStorage对于每个窗口/选项卡都是唯一的,并且是临时的,与localStorage不同,后者更长期。

You can even set a time/date stamp to determine how old the data can get before it is considered stale and needs refreshed. 您甚至可以设置时间/日期戳,以确定数据在被视为过时且需要刷新之前可以获得的时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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