我使用此代码加载外部网址,但它只显示空白页
window.open(result.invocationResult.data , '_blank');
result.invocationResult.data
正确地获取网址,它可以在PC浏览器上运行,在Android 4.4上运行失败,我还在移动浏览器上测试该应用程序,并且它在移动应用程序中运行并失败。
这是我的catlog:
07-10 12:53:13.890: D/InAppBrowser(1204): target = _blank
07-10 12:53:13.890: D/InAppBrowser(1204): in blank
07-10 12:53:14.880: I/Choreographer(1204): Skipped 134 frames! The application may be doing too much work on its main thread.
07-10 12:53:14.920: W/AwContents(1204): nativeOnDraw failed; clearing to background color.
07-10 12:53:15.900: W/AwContents(1204): nativeOnDraw failed; clearing to background color.
07-10 12:53:15.950: W/AwContents(1204): nativeOnDraw failed; clearing to background color.
07-10 12:53:15.990: W/AwContents(1204): nativeOnDraw failed; clearing to background color.
07-10 12:53:16.000: W/AwContents(1204): nativeOnDraw failed; clearing to background color.
07-10 12:53:16.050: W/AwContents(1204): nativeOnDraw failed; clearing to background color.
07-10 12:53:16.080: W/AwContents(1204): nativeOnDraw failed; clearing to background color.
07-10 12:53:16.110: W/AwContents(1204): nativeOnDraw failed; clearing to background color.
07-10 12:53:16.140: W/AwContents(1204): nativeOnDraw failed; clearing to background color.
07-10 12:53:16.190: W/AwContents(1204): nativeOnDraw failed; clearing to background color.
07-10 12:53:16.280: D/CordovaLog(1204): data:text/html,chromewebdata: Line 12 : Not allowed to load local resource: file:///android_asset/webkit/android-weberror.png
07-10 12:53:16.290: I/chromium(1204): [INFO:CONSOLE(12)] "Not allowed to load local resource: file:///android_asset/webkit/android-weberror.png", source: data:text/html,chromewebdata (12)
07-10 12:53:16.360: D/CordovaWebViewClient(1204): onPageFinished(file:///data/data/com.test/files/www/default/index.html#&ui-state=dialog)
07-10 12:53:16.370: D/CordovaActivity(1204): onMessage(onPageFinished,file:///data/data/com.test/files/www/default/index.html#&ui-state=dialog)
07-10 12:53:16.720: I/chromium(1204): [INFO:CONSOLE(12)] "Not allowed to load local resource: file:///android_asset/webkit/android-weberror.png", source: data:text/html,chromewebdata (12)
07-10 12:53:17.010: I/Choreographer(1204): Skipped 52 frames! The application may be doing too much work on its main thread.
我的网址是:
myUrl = 'https://10.0.177.119:9444/teamworks/process.lsw?zWorkflowState=1&zTaskId=108355&zResetContext=true';
它在openssl上创建了https证书。 平台版
platformVersion="6.1.0.00.20131219-1900"
和android版:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19"/>
答案 0 :(得分:0)
在我的main.js中,我使用了window.open("http://www.apache.org", "_blank);
并在Android模拟器(Android 4.4.2)中启动了该应用。
它成功开启。
尝试使用&#39;常规&#39;如上所述的URL;看它是否打开。
如果它打开而你不打开,也许问题就在那里。
注意:
答案 1 :(得分:0)
即使我今天遇到同样的错误并且正在寻找解决方案。我发现我犯的错误非常愚蠢。我忘了在清单文件中添加<uses-permission android:name="android.permission.INTERNET"/>
。
我知道现在回答这个问题已经很晚了。但我希望这个答案可以帮助那些正在寻找具有相同问题的解决方案的人。
答案 2 :(得分:-1)
问题与AuthRealm或https证书有关,我有一个AuthRealm来访问BPM Process Center的服务,如果我更改这样的URL,我可以避免这个错误:
myUrl = 'http://ectest556ws1:9081/teamworks/process.lsw?zWorkflowState=1&zTaskId=108355';