javascript - 带phonegap 2.0的childbrowser

标签 javascript ios cordova

由于phonegap 2 window.plugins不再可用,但childBrowser仍然依赖它。 如何在phonegap 2项目中调用childBrowser插件?

这在 1.9 中运行良好:

cb = window.plugins.childBrowser;

最佳答案

首先从这里下载最新的 child 浏览器https://github.com/phonegap/phonegap-plugins/tree/8848e8dd7f0d93810eec49fb1124f6389c963b68/Android/ChildBrowser

使用2.0.0版本

插件创建对象window.plugins.childBrowser。要使用,请调用以下可用方法之一:

  /**
    * Display a new browser with the specified URL.
    * This method loads up a new web view in a dialog.
    *
    * @param url           The url to load
    * @param options       An object that specifies additional options
    */
  showWebPage(url, [options])
Sample use:

window.plugins.childBrowser.showWebPage("http://www.google.com", { showLocationBar: true });
  /**
    * Close the browser.
    */
  close() {
Sample use:

window.plugins.childBrowser.close();
  /**
    * A user supplied call back which is run when the browser is closed.
    */
  onClose() 
Sample use:

window.plugins.childBrowser.onClose();
  /**
    * A user supplied call back which is run when the browser location changes.
    * The method is called with the new location of the browser.
    */
  onLocationChange(location) 
Sample use:

window.plugins.childBrowser.onLocationChange(location);
  /**
   * Display a new browser with the specified URL.
   * 
   * NOTE: If usePhoneGap is set, only trusted PhoneGap URLs should be loaded,
   *       since any PhoneGap API can be called by the loaded HTML page.
   *
   * @param url           The url to load
   * @param usePhoneGap   Load url in PhoneGap webview [optional] - Default: false
   */

  openExternal(url, [usePhoneGap])
Sample use:

window.plugins.childBrowser.openExternal("http://www.google.com");

关于javascript - 带phonegap 2.0的childbrowser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11713204/

相关文章:

android - 在现代移动应用程序中管理 session 的实践

android - ionic navigator.camera.getPicture 不会从 PHOTOLIBRARY 返回图像

javascript - 用 jQuery 插入的元素不会立即出现

javascript - 谷歌地图 API : Adding letters to my markers on my google map

ios - Socket.io - 维护套接字连接(Swift)

IOS:stringByReplacingOccurrencesOfString 不起作用

javascript - 移动应用程序中的 PDF.JS Access-Control-Allow-Origin 问题

javascript - 为什么 $render 从来没有接到电话

php - header 发送后重定向到当前页面

iOS NSMutableURLRequest 授权 header