XDK - open link in browser without using Cordova

2019-08-07 12:09发布

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?

2条回答
Summer. ? 凉城
2楼-- · 2019-08-07 12:22

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

查看更多
啃猪蹄的小仙女
3楼-- · 2019-08-07 12:33

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

查看更多
登录 后发表回答