问题描述
我正在开发一个应用程序,作为一个包装器,使用Phonegap / Cordova v3.4在应用程序中显示外部适合移动设备的网站(即从互联网上直播)。
一切正常,加载正常。
我的问题是,我想要任何外部链接在该页面上打开操作系统的默认浏览器,而是
通过使用 InAppBrowser
window.open(url,'_system');
由于本地HTML文件的页面不 c $ c> _system target没有任何效果。
我已复制 phonegap.js
, cordova.js
和 cordova_plugins.js
文件加载到外部网站,
目前正在HTC One Max的Android 4.3,iOS模拟器及其他平台上进行测试,但是它仍然无法在操作系统浏览器中打开链接。 WP8模拟器。
GitHub为应用程序提供的完整代码 - 以及加载外部网站时所包含的JavaScript的Pastebin。
任何帮助将不胜感激。
我发现,当我使用'_system'上下文打开时,我必须确保我传递http://作为链接的一部分。尝试打开google.com没有任何效果,尝试打开。 p>
I'm developing an app which acts as a wrapper to display an external mobile-friendly website (i.e. live from the internet) within an app using Phonegap/Cordova v3.4.
Everything works and loads fine.
My problem is that I want any "external links" on that page to open in the OS' default browser, rather than within the app itself (i.e. links to Facebook).
I know the standard procedure for this for local HTML files by using the InAppBrowser
code:
window.open(url, '_system');
Since the page is not on a local HTML file, the _system
target is not having any effect.
I have copied the phonegap.js
, cordova.js
and cordova_plugins.js
file to the external site and load them when it detects that is being called within an app, however it still does not allow the links to open in the OS browser.
Currently testing on HTC One Max on Android 4.3, iOS Emulator and WP8 Emulator.
Full code available from GitHub for the app - and Pastebin for the javascript included on the external site it loads.
Any help would be appreciated.
I found that I had to be sure I was passing "http://" as part of my link when opening with the '_system' context. Trying to open "google.com" did nothing, trying to open "http://google.com" worked.
这篇关于在默认浏览器中使用Phonegap / Cordova打开链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!