且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何打开与在WinJS外部浏览器参数的URL

更新时间:2023-09-21 23:14:10

试试这个其他:

  //消息加密和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");