此函数禁用链接的默认操作,并使用 pushState 函数更改 URL。我需要能够检测浏览器是否不支持此功能,以便我可以停止 preventDefault() 功能。
$("a").click(function(event) {
var url = "";
var url = $(this).attr('href');
// Disable Default Action and Change the URL -
event.preventDefault();
window.history.pushState("somedata", "Title", url);
//Call Function to change the content -
loadContent(url);
});
非常感谢任何建议