Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在AppBrowser中检索当前所在的url_Javascript_Url_Cordova_Inappbrowser - Fatal编程技术网

Javascript 如何在AppBrowser中检索当前所在的url

Javascript 如何在AppBrowser中检索当前所在的url,javascript,url,cordova,inappbrowser,Javascript,Url,Cordova,Inappbrowser,我正在尝试使用InAppBrowser for Cordova与Google一起执行oAuth,我需要检索当前url以存储访问令牌。我想知道是否有某个命令可以检索用户所在的当前URL。 我的代码: window.open( authUri, { showLocationBar : false } ); window.open( authUri, { showLocationBar : false } ).addEventListener( 'loadstart', function() {

我正在尝试使用InAppBrowser for Cordova与Google一起执行oAuth,我需要检索当前url以存储访问令牌。我想知道是否有某个命令可以检索用户所在的当前URL。 我的代码:

window.open( authUri, { showLocationBar : false } );

window.open( authUri, { showLocationBar : false } ).addEventListener( 'loadstart', function() {
    if ( event.url.indexOf( "code=" ) != -1 )
    {
        alert( "hey" );
        var lel = URL;
    }
});

window.open( lel, { showLocationBar : false } ).addEventListener( 'loadstart', $this.onAuthUrlChange );
window.open( lel, { showLocationBar : false } ).addEventListener( 'loadstop', $this.onAuthClose );

我也遇到了同样的问题,用这样的方法解决了

this.document.location.href