Hi,
Since the release of 5.2.0, links won't open inside the app's webview any longer. Instead, the apps open in the device's browser. This is the opposite of how links used to work. Before 5.2.0, all links opened in webview by default. Does anyone have a solution? I don't want to use the inappbrowser. I'm just trying get a website to load directly in the app's webview.
Here's my preferences from my config.xml
preference name="phonegap-version" value="cli-5.2.0" /
preference name="webviewbounce" value="false" /
preference name="load-url-timeout" value="150000" /
preference name="stay-in-webview" value="true" /
access origin="*" browserOnly="true" /
gap:plugin name="cordova-plugin-whitelist" source="npm" /
In my index.html
a href="http://www.google.com" (just a regular link)
Since the release of 5.2.0, links won't open inside the app's webview any longer. Instead, the apps open in the device's browser. This is the opposite of how links used to work. Before 5.2.0, all links opened in webview by default. Does anyone have a solution? I don't want to use the inappbrowser. I'm just trying get a website to load directly in the app's webview.
Here's my preferences from my config.xml
preference name="phonegap-version" value="cli-5.2.0" /
preference name="webviewbounce" value="false" /
preference name="load-url-timeout" value="150000" /
preference name="stay-in-webview" value="true" /
access origin="*" browserOnly="true" /
gap:plugin name="cordova-plugin-whitelist" source="npm" /
In my index.html
a href="http://www.google.com" (just a regular link)
- 3 Posts
- 0 Reply Likes
Posted 5 years ago
- 8261 Posts
- 263 Reply Likes
- 3 Posts
- 0 Reply Likes
Thanks for getting back to me. Here in my relevant code in the config.xml:
And here is my relevant code in the index.html:
Thanks!
<preference name="phonegap-version" value="cli-5.2.0" />
<preference name="webviewbounce" value="false" />
<preference name="load-url-timeout" value="150000" />
<preference name="stay-in-webview" value="true" />
<access origin="*" browserOnly="true" />
<gap:plugin name="cordova-plugin-whitelist" source="npm" />
And here is my relevant code in the index.html:
<a href="http://www.google.com">Google</a>
Thanks!
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
Well, you refrain from using the inAppBrowser plugin at your own risk....and this is what happens.
If you had taken over control by using the plugin, you wouldn't have had to deal with this mess.
You can still do so. The inAppBrowser plugin allows you to opens external sites in the webview, as well as in the system browser or a separate inApprowser window.
See the documentation at https://github.com/apache/cordova-plu... and especially:
target [parameter]: The target in which to load the URL, an optional parameter that defaults to _self. (String)
_self: Opens in the Cordova WebView if the URL is in the white list, otherwise it opens in the InAppBrowser.
_blank: Opens in the InAppBrowser.
_system: Opens in the system's web browser.
If you had taken over control by using the plugin, you wouldn't have had to deal with this mess.
You can still do so. The inAppBrowser plugin allows you to opens external sites in the webview, as well as in the system browser or a separate inApprowser window.
See the documentation at https://github.com/apache/cordova-plu... and especially:
target [parameter]: The target in which to load the URL, an optional parameter that defaults to _self. (String)
_self: Opens in the Cordova WebView if the URL is in the white list, otherwise it opens in the InAppBrowser.
_blank: Opens in the InAppBrowser.
_system: Opens in the system's web browser.
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
@Petra,
the OP is missing to important components in the
Add the following to your
- Whitelist Plugin Documentation
allow-navigate - Controls which URLs the WebView itself can be navigated to. Applies to top-level navigations only.
allow-intent - Controls which URLs the app is allowed to ask the system to open. By default, no external URLs are allowed.
access - Controls which network requests (images, XHRs, etc) are allowed to be made (via cordova native hooks).
Those comments straight from the docs. They will also go in an upcoming blog under the heading DANGEROUS, BUT WORKING
- Whitelist Plugin Documentation
Best of Luck
Jesse
the OP is missing to important components in the
config.xml. However, i tend to agree with your comments and reasoning. The following is for the Original Poster to make an objective decision:
Add the following to your
config.xml, they are DANGEROUS, BUT WORKING
- Whitelist Plugin Documentation
<allow-navigation href="*" />
<allow-intent href="*" />
allow-navigate - Controls which URLs the WebView itself can be navigated to. Applies to top-level navigations only.
allow-intent - Controls which URLs the app is allowed to ask the system to open. By default, no external URLs are allowed.
<access origin="*" />
access - Controls which network requests (images, XHRs, etc) are allowed to be made (via cordova native hooks).
Those comments straight from the docs. They will also go in an upcoming blog under the heading DANGEROUS, BUT WORKING
- Whitelist Plugin Documentation
Best of Luck
Jesse
- 3 Posts
- 0 Reply Likes
Thank you all for your help! This resolved the issue. I appreciate it very much.
- 1 Post
- 0 Reply Likes
How do I fix ?
JesseMonroy650 (Volunteer), Champion
- 3325 Posts
- 122 Reply Likes
You read the instructions.
This FAQ should also help. Read the bold sentences first.
Top Mistakes by Developers new to Cordova/Phonegap
This FAQ should also help. Read the bold sentences first.
Top Mistakes by Developers new to Cordova/Phonegap
Related Categories
-
PhoneGap Build
- 15111 Conversations
- 275 Followers



