XDK - open link in browser without using Cordova

≡放荡痞女 提交于 2019-12-11 05:29:38

问题


I want you to open a link in my app via browser not in Appview. I ma making my html5 mobile app via xdk. I don't want to use cordova in my app as my app is heavy enogh and don't want to make it heavier because of just one link. I saw this :

<a href="#" onclick="window.open('http://www.kidzout.com', '_system');">www.kidzout.com</a>

But the problem is I must install Cordova InAppBrowser plugin for this to work. Do you have any solution without using Cordova or external plugins? Do you think is it possible at all?


回答1:


You can open a link in the native browser(Mobile Safari, Android, etc.) from within a HTML5 Mobile app using the intel.xdk API formerly AppMobi.

In the head, include a reference to the intelxdk.js file.

<script src="intelxdk.js"></script>

Use this for opening your link:

<a href="#" onclick="intel.xdk.device.launchExternal('http://www.intel.com');">Launch in Browser</a>

For more information, go to http://www.html5dev-software.intel.com/documentation/jsAPI/device/launchExternal/index.html




回答2:


If you are opening a remote URL in your webview and adding javascript is not an option, you can make a patch in native code.

Here I show the workaround for Android: https://stackoverflow.com/a/35037737/813951



来源:https://stackoverflow.com/questions/24377913/xdk-open-link-in-browser-without-using-cordova

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