Created
July 28, 2015 08:45
-
-
Save laispace/ae3c60783d342cfeaa16 to your computer and use it in GitHub Desktop.
打开一个新页面
This file contains hidden or 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
/** | |
* 打开一个新的页面 | |
* @param {String} url | |
*/ | |
openWindowByUrl: function(url) { | |
var a = document.createElement('a'); | |
a.href = ''; | |
a.setAttribute("target", '_blank'); | |
var evt = document.createEvent("HTMLEvents"); | |
evt.initEvent("click"); | |
a.dispatchEvent(evt); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment