phonegap中怎么打开浏览器?

王道中强流 发布于 2012/02/07 21:35
阅读 4K+
收藏 3

在phonegap中这样的链接

<a href="http://www.dabulo.com/" target="_blank">大部落</a>

点击后是可以打开浏览器的,

但是window.open("http://www.dabulo.com/")这样的JS不会打开浏览器

我想知道JS的打开浏览器的方法,求解

加载中
0
鉴客
鉴客

https://github.com/callback/callback-ios/blob/master/PhoneGapLib/Classes/PhoneGapDelegate.m#L669显示:

  1. if the URL has scheme gap:// it does not open Safari
  2. if the URL has scheme file:// it does not open Safari
  3. if the OpenAllWhitelistURLsInWebView policy is set it does not open Safari.
  4. if navigationType == UIWebViewNavigationTypeOther && mainDocument != nil then it does open Safari.

4 阐述:

  • ~NavTypeOther signifies that the navigation is not from: a link click, back/fwd button, reload, or form re/submission. (AKA window.location.href assignment, or window.open(...))
  • mainDocument != nil signifies that the link is not from an iFrame? and/or doesn't have a target?

因此,基本上,我认为这唯一的链接点击在 UIWebView 中打开 (除非它们的差距: / / file:// 链接,或者设置策略。)

0
林宝基
林宝基

有用。

 

0
林宝基
林宝基
  1. navigator.app.loadUrl(url,{ openExternal:true });  
  2. The "navigator.app" object is only available on Android. Luckily in the soon to be released 2.3.0 version of PhoneGap you will be able to do:
    window.open("http://www.google.com", "_system");
返回顶部
顶部