Childbrowser with Cordova 1.7 iPhone issue

自闭症网瘾萝莉.ら 提交于 2019-12-12 02:16:22

问题


Can any expert here please point me to some valid walkthrough on how to make the ChildBrowser work with Cordova 1.7 in iPhone? I have found lots of documents and blogs out there that tell you how to do it, but none of them have worked for me. It is not a whitelist issue for sure, as for the time being I have set it to the wildcard *, so whitelisting problems can be safely ruled out I guess. In some cases, ChildBrowser was successfully installed, but when I called the showwebpage function, it just would not show up (there wouldn't be any errors either!). Other times, it just won't even install. I have already spent 2 days on it, and am still clueless. Just hoping if you could help me out. Any help would be appreciated.


I could finally get the ChildBrowser to open up following what Dhawal has suggested below. But the onLocationChange event never seems to fire. Again, this seems to be a common problem with Cordova 1.7. Any workarounds apart from rolling back to some older Cordova version? Any help would be appreciated.

Here's what I am trying to do:

window.plugins.childBrowser.showWebPage(url, { showLocationBar: true });
window.plugins.childBrowser.onLocationChange = function(loc){ alert("In index.html new loc = " + loc); };

Ok, got it to work. Seems like ChildBrowser is still compatible with older versions of Cordova only. Had to delve into Objective-C and make changes in the plugin to make it work.


回答1:


I have a basic application which has childbrowser integration with Cordova 1.7. I have put the steps also to generate build same application.

ios-cordova-childbrowser

Edit

Childbrowser events were not getting called properly so I added this fix in ChildBrowser.js file to resolve it.

if (cordovaRef && cordovaRef.addConstructor) {
    cordovaRef.addConstructor(ChildBrowser.install);

    // Make ChildBrowser global
    window.ChildBrowser = ChildBrowser;
 } else {
    console.log("ChildBrowser Cordova Plugin could not be installed.");
    return null;
 }


来源:https://stackoverflow.com/questions/11027479/childbrowser-with-cordova-1-7-iphone-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!