Run protocol handler without opening windows in Javascript
I have a javascript that opens FILE with TextMate with txmt protocol. It works fine, but the problem is that I have a blank Safari window when this script is run.
document.onkeydown=function(e){
if(e.which == 17) isCtrl=true;
if(e.which == 69 && isC开发者_StackOverflowtrl == true) {
mywindow = window.open("txmt://open/?url=file://FILE","myWindow");
return false;
}
}
How can I not open the blank window?
Try window.location = "your link"
You could try using XHR. Might work.
"Make your link, then simulate a click on it." was my first thought on how to do this. I've now tried it and it doesn't work, so I edited the answer to reply with this comment. It works fine for http links but not for anything else. I'm leaving this here because I would be interested if anyone knows why it doesn't work.
精彩评论