本文介绍了如何打开与在WinJS外部浏览器参数的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS2012开发WinJS地铁应用程序,我想打开这个地址

  window.location的=htt​​p://XXX.XXX.XX.XXX:XXXX/test/AU/jsp/AU000007.jsp;

这工作正常,从我的应用程序地铁上打开新的浏览器网页

不过,我想补充用jcrypto加密的几个参数,所以我这样做:

  //消息加密
消息= jcrypto(消息);
消息=htt​​p://XXX.XXX.XX.XXX:XXXX/test/AU/jsp/AU000007.jsp?data=+消息;window.location的=消息;

但它只是打开我的地铁应用,如何解决该链接???


更新:感谢WiredPrairie的建议,我发现了这样的回答:

  VAR URI =新Windows.Foundation.Uri(http://XXX.XXX.XX.XXX:XXXX/test/AU/jsp/AU000007.jsp?data= + jcrypto(消息));    //打开外部浏览器的网址
    Windows.System.Launcher.launchUriAsync(URI).done(
        功能(成功){
            如果(成功){执行console.log(页面正确打开); }
            其他{的console.log(发生了错误); }
            });


解决方案

试试这个其他:

  //消息加密和URL除了
消息=htt​​p://XXX.XXX.XX.XXX:XXXX/test/AU/jsp/AU000007.jsp?data=+ jcrypto(消息);window.open(消息,_blank,全屏= YES,身高= 600,宽度= 800,滚动条=是,可调整大小=无);

I have a metro app developed with WinJS in VS2012 and I want to open this address

window.location = "http://XXX.XXX.XX.XXX:XXXX/test/AU/jsp/AU000007.jsp";

this works ok, opens the webpage on new browser from my metro app

But I want to add several parameters encrypted by using jcrypto so I do this:

//message encryption
message = jcrypto(message);
message = "http://XXX.XXX.XX.XXX:XXXX/test/AU/jsp/AU000007.jsp?data=" + message;

window.location = message;

but it just opens the link on my metro app, how to fix that???


UPDATE: thanks to WiredPrairie's suggestion I found this answer:

    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"); }
            });
解决方案

try with this other:

//message encryption and URL addition
message = "http://XXX.XXX.XX.XXX:XXXX/test/AU/jsp/AU000007.jsp?data=" + jcrypto(message);

window.open(message, "_blank", "fullscreen=yes,height=600,width=800,scrollbars=yes,resizable=no");

这篇关于如何打开与在WinJS外部浏览器参数的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 15:59