Created
December 25, 2014 14:24
-
-
Save alphatr/085b81503f9032ca96cc to your computer and use it in GitHub Desktop.
不被拦截的 window.open 写法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 不被拦截的 window.open 写法 | |
* 2014-12-25 | |
*/ | |
$('#btn').on('click', function (e) { | |
e.preventDefault(); | |
var handle = window.open('about:blank'); | |
// 模拟 Ajax 返回 | |
$.get('xxx.api', function (data) { | |
if (data) { | |
handle.location.href = 'https://blog.alphatr.com/'; | |
} else { | |
handle.close(); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment