【发布时间】:2014-01-09 13:41:27
【问题描述】:
我有一个在VS2012中用WinJS开发的metro应用,我想打开这个地址
window.location = "http://XXX.XXX.XX.XXX:XXXX/test/AU/jsp/AU000007.jsp";
这工作正常,从我的 Metro 应用程序在新浏览器上打开网页
但我想添加几个使用 jcrypto 加密的参数,所以我这样做:
//message encryption
message = jcrypto(message);
message = "http://XXX.XXX.XX.XXX:XXXX/test/AU/jsp/AU000007.jsp?data=" + message;
window.location = message;
但它只是打开了我的 Metro 应用程序上的链接,如何解决这个问题???
更新:感谢 WiredPrairie 的建议,我找到了这个答案:
var uri = new Windows.Foundation.Uri("http://XXX.XXX.XX.XXX:XXXX/test/AU/jsp/AU000007.jsp?data=" + jcrypto(message));
//opens the url on external browser
Windows.System.Launcher.launchUriAsync(uri).done(
function (success) {
if (success) { console.log("page opened correctly"); }
else { console.log("an error has occured"); }
});
【问题讨论】:
-
你为什么不用
LaunchUriAsync来启动网页? -
感谢您用您的解决方案更新我的帖子
标签: javascript url browser winjs