- 我注册了两个协议。
- 当我在同一个事件中尝试调用这两个协议时,在Chrome浏览器中只有一个会被调用。
$(function () {
$("div[href]").click(function (event) {
debugger;
//for validation purpose.
window.location = "abcd:";
//if it is validated then
window.location ="xyz:";
});
});
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Custom Protocol Detection</title>
</head>
<body id="abcd">
<h1>Click one of these labels:</h1>
<a href="#" id="atemp"></a>
<div href="blahblah:randomstuff" style="background-color:aquamarine">
Non-exist protocol
</div>
<div href="mailto:johndoe@somewhere.com" style="background-color:aqua">
Send email
</div>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="example.js"></script>
</body>
</html>
window.location
。但是,您可以同时执行多个ajax调用。 - Geert-Janwindow.open()
吗?(或者像Geert所说的多个ajax调用)window.location
是当前窗口的地址,赋值两次是没有意义的。 - MT-FreeHK