我甚至不知道如何正确地表达这个标题。我正在寻找一种方法,在加载页面时将其设置为已访问,然后运行命令。下一次我加载网页时,它将被标记为已访问,因此它将执行另一段代码。
示例:
(function(){
//Detect if page is visited, and direct it to the correct part of the code
//This is the set of code to run if the page has not been visited, Set page as visited here
$( "#button" ).click();
//Run this if the page has been marked as visited
setTimeout(function(){
window.close();
}, 50);
})();对于Jquery和其他类似的东西,还是相当陌生的,请原谅我的无知。
发布于 2014-07-22 03:54:03
跨站点的多个视图存储信息的常用方法是使用cookies。您可以使用cookie来跟踪页面是否被访问过。Cookie对于用户的计算机来说是本地的,所以效果应该是你想要的效果。
下面是一个不错的小cookie实用程序:
https://github.com/carhartl/jquery-cookie
您可以使用它来跟踪站点是否被访问过,然后您的代码可以检查它的值,并根据它的值执行不同的代码。
https://stackoverflow.com/questions/24873517
复制相似问题