fix open url in app

This commit is contained in:
life
2015-03-08 03:33:40 +08:00
parent 3d80477bf1
commit 67f35279ff
3788 changed files with 546958 additions and 77036 deletions

View File

@@ -1432,6 +1432,24 @@ var Pren = {
}
});
function isURL(str_url) {
var re = new RegExp("^((https|http|ftp|rtsp|mms|emailto)://).+");
return re.test(str_url);
}
// 浏览器打开
function openExternal(url) {
gui.Shell.openExternal(url);
}
// 防止在本窗口打开
me.presentationO.on('click', 'a', function(e) {
e.preventDefault();
var href = $(this).attr('href');
if(href.indexOf('http://127.0.0.1') < 0 && isURL(href)) {
openExternal(href);
}
});
$('.pren-tool-close').click(function() {
me.togglePren();
});