浏览网站时,除了检查下载的HTML文档的“网络”选项卡(在开发工具中)以外,是否有其他方法可以检测出它是使用客户端路由还是服务器端路由?
You could use the beforeunload
event to decide what type of routing that is.
window.addEventListener('beforeunload', function (e) {
console.log(e);
// This is usually used to block user navigation, for example, when they have not saved cahnges
/**
* // Cancel the event
* e.preventDefault();
* // Chrome requires returnValue to be set
* e.returnValue = '';
*/
});
To detect changes to DOM, you could use MutationObserver
. But I would either useone or the other.
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.