[英]How to check if a page's content has been modified?
1 - I have a web page, in that page there are many external links 1-我有一个网页,该网页中有许多外部链接
2 - When user click on any external link then a popup should be come with the message that page has been modified by dynamic action or it not. 2-当用户单击任何外部链接时,将弹出一个消息,提示已通过动态操作修改了页面或未通过动态操作对其进行了修改。
3 - How can I check the page status using JavaScript / jQuery? 3-如何使用JavaScript / jQuery检查页面状态?
Thanks in advance. 提前致谢。
Add some state variable to javascript, like: 在javascript中添加一些状态变量,例如:
wasModified = false;
Subscribe on click event of every external link or whatever you want to react on, like that: 订阅每个外部链接或您想对其作出反应的事件的click事件,例如:
$('.external-link-class-selector').click(function(){
wasModified = true;
//in case click mean it was modified and you should notify user
alert('Page was modified');
});
see 看到
$.ajax({
url: "",
type: "post",
dataType: "" ,
data: ,
}).done(function() {
//sucess
});
make a function in Javascript including above function and Post values by this method to the same page and append success message on the page. 使用此方法在Javascript中创建一个函数,包括上述函数和Post值,并在该页面上添加成功消息。
您可以更改窗口/主体的“ onhaschange”事件,只需设置一些标志即可检查链接的单击以显示页面是否被更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.