I’m trying to add navigation links to a WebView in my Android app but WebView.canGoBack() always returns false. I’ve read a few posts on SO that said it’s a bug and have tried different suggestions including shouldOverrideUrlLoading() to no avail. So I decided that it just doesn’t work and added navigation links to my web page instead:
<i class="fa fa-arrow-left"></i>
<i class="fa fa-arrow-right"></i>
I also have JavaScript enabled:
webView.getSettings().setJavaScriptEnabled(true);
The links work fine when the pages are opened in a browser such as Firefox on the device however, they fail to work when the page is viewed in the WebVeiw.
Any help would be appreciated.
Update - I tried targeting and compiling with API 28. Same results.
Looks like its a bug in WebView. I'm running Chrome v67.
https://groups.google.com/a/chromium.org/forum/#!topic/android-webview-dev/YYxyjl2WZTA
WebView's history and associated canGoBack() and goBack() methods do not work properly when Google Chrome version 63.0.3239.111 is installed on the device. Uninstalling or disabling Google Chrome and its webview implementation solves the issue.
This issue ist tested and confirmed on Android versions 6.0.1, 7.1.2 and 8.1.0.
Issue description:
Saving the webview history does not work properly, when Chrome is installed. When you use webView.goBack() to navigate back to the page visited before, sometimes this page is skipped and the webView goes back to the first visited webpage. Other times the history is simply empty resulting in webView.canGoBack() returning false, although you had visited a page just before.
Workaround solution:
Uninstall chrome from device or disable it by using the System Developer Option 'WebView implementation'.
Google, please provide a Chrome update which solves this issue permanently. Our users are very confused by this inconsistent behavior. If this is not the right forum for developer topics, please advise in which forum or Google Group this issue should be posted and tracked.
Thank you very much in advance.
Related
I have some problems with my website. My site is coded in HTML,CSS and JS.
Everywhere works perfect, Desktop (all browsers), Android (All browsers), in iPhone(iOS.11) doesn't work!!!
I think there may be two problems:
1. When i open the site, i have Loading Page script, and in iPhone it stops there and doesnt open the site.
2. The problem may also be with the new iOS 11, because with earlier iOS(10) was working very well.
Any suggestion, or any site which i can check my errors (debugg) or..?
google didn't solve my problem so i decided to ask, but still can't find the problem!!!
Thanks.
If you have an OSX available you can enable remote debug and see what's happening, most likely something is breaking based on something not being available.
Steps to reproduce the problem:
enter http://www.javascriptoo.com/howler-js
go to examples on the top on the page
press "back" chrome button
the crash report is not generated for this bug.
How to fix it ?
It's solved in latest Chrome beta. Not sure what you can do in the meantime - we just replaced the library instead.
Ever since Chrome updated itself to version 32, I have been experiencing aggravating bugs. One of the worst is when editing the DOM using the Web Inspector, and Chrome will about every minute start popping up this dialog, which yanks focus from the Web Inspector:
It's complaining about the Web Inspector itself being "unresponsive", when it really isn't, and nothing's gone wrong.
This particular page I'm messing with is making use of the mutation-summary library. Perhaps the bug in Chrome that thinks stuff is unresponsive could be related to setting various continuously-running setTimeouts. I say this because I observe similar behavior in the web app we build at work where this has also started happening (and is equally annoying).
The workaround is I believe it is possible to just ignore the dialog and work can continue. I wonder if anyone else (or everyone else) has been experiencing this issue?
I started getting this problem as well.
In searching, I came accross this issue https://code.google.com/p/chromium/issues/detail?id=335248.
As best I figured out, the bug is related to:
Windows 7/8 with Aero Theme
Scrollbars on pages (such as in the developer console)
Pages with popups (in particular Window.open() calls)
I guess they are slated to push the fix into version 33...and maybe leave the stable* 32 how it is (although I hope not).
So there are a few options:
Switch away from Aero Theme until version 33 is in stable
Upgrade to the beta channel, i.e. version 33
Click on the Wait button every 30 seconds whenever the chrome developer tools is open.
Update:
Chrome has released a hotfix into the version 32 stable channel. http://googlechromereleases.blogspot.ro/2014/01/stable-channel-update_27.html
Thanks to #probackpacker for bringing it to my attention.
I have experienced this as well on Windows, it seems that this will happen in general when using the browser (not only within the web inspector). It also seems to happen more often when loading flash content (such as a game). The browser and flash areas are responding normally, but the browser thinks that they are not for whatever reason. Pressing wait seems to hide the dialog for a few minutes until it will re-appear again.
I've read that this bug is fixed in the next beta (version 33).
Regards,
Moses
I have also experienced this issue. The change of theme workaround has worked, and the Chromium team has provided the following update today:
... We understand your frustration and are actively working to resolve
it. When you add that comment, it’s confusing the comments around
whether we’re able to fully fix it on canary. If we can confirm it’s
fully fixed in canary, we can merge into the stable channel and
everyone can get the fix. So please refrain from saying thatyou’re
having this problem, too. I assure you we’re actively working on a
fix.
This statement was taken from Chromium ticket #335248.
Okay here’s the solution you can do without changing your theme, right click on my computer, go to your System Properties, and then go to "Advanced", click on "Settings" under Performance, then check the below radio button. This seems to stop it
If the aero fix isn't working for you, download Chrome Beta
I have had this same issue with Chrome 32 (there are so many problems in the dev tools...) but it ONLY happens for me when I have the dev tools detached / undocked from the main browser window.
You might be able to avoid it by re-docking the devtools if you are using them in un-docked mode.
August 6, 2014 - I solved this by installing the latest Chrome Beta https://www.google.com/chrome/browser/beta.html
You can solve this problem in Chrome by following simple steps-
1-Go to Setting
2-Go to Advance Setting
3-Uncheck the "Use Hardware Acceleration when available".
I fixed that problem by linking modem directly to my PC, didn't reinstall or change Chrome or anything. I skipped connection through my wireless router which I think was the problem from the start... now all the pages Chrome couldn't load are loading with no problem at all. Maybe it's time to by a new router...
I have tried using JavaScript "AddFavorite" function in my code, but it does not work in Safari. It works in IE, I think I remember Firefox, but nothing I have tried seems to work in Safari. All I want to do is have a link on my website that people can click on and it automatically creates a bookmark in their bookmarks folder/bookmark bar.
Does this entail Applescript or something like it? Or a deeper programming language I am unaware of?
<a href="javascript:bookmarksite('Name', 'website.com')">
From the apple forums: forum-link
On the Mac side at least, Safari does not allow a website to add a
bookmark. I'm pretty sure the same behaviour is in the Windows version
as well.
I've been down this road, and what I discovered was that Safari does NOT allow bookmarks to be made with JavaScript:
Apple Forum
bytes forum
They consider it unsafe. As frustrating as this is, I get their point.
Unfortunately, most things like this tend to be browser-specific, and picky.
my JS is about level 0, but i did find this on an old article here:
One specifically for Chrome:
Add to favourites link for Google Chrome
And another on a cross-browser bookmark link:
Cross-browser bookmark/add to favorites javascript
Hope between the previous comment and these links, you get what you needed.
Chrome and Safari does not allow it for clear security reason.
You could usee a script like this:
http://www.dynamicsitesolutions.com/javascript/add-bookmark-script/
which handles many browser and has a nice fallback: show a browser customized alert with instructuion message.
Es: in chrome it says: "Ctrl+D to add as bookmark"
In IE something similar to the following would work: (MSDN)
window.external.AddFavorite(location.href, document.title);
However, this won't work in other browsers. In Firefox, I believe you can use
window.sidebar.addPanel(document.title, location.href, '');
to create a sidebar panel (not a real bookmark) but as far as I know Chrome and Safari do not allow Javascript to automatically create bookmarks. For those, I recommend giving the user the instructions to do it manually:
drag a link to their bookmarks
pressing Ctrl + D to add a bookmark
Clicking + or star icon in the toolbar
We are using ASP.NET for our Canvas Page, however none of the link buttons (JavaScript Post Backs) work when using FireFox.
After a bit of investigation it appears that any javascript link i.e. <a href="javascript:..."> will not run.
When viewing the iFrame outside of Facebook the links work as expected.
Bizarrely javascript on an "onclick" event does work correctly.
Facebook Canvas: http://apps.facebook.com/ukflive/test.aspx
Any thoughts on why this is happening, and how to resolve this? Other browsers such as Safari and Chrome do not have this issue.
Many Thanks,Ady
In some versions of firefox i've met same problem but i wasn't able to find out reason of problem since i've seen your question. thank you for this :). In my opinion it is a firefox bug working with iframes, and it is related with security concerns.
i've changed all <a href="javascript:anyJSFunction()"> codes to <a href="javascript:;" onclick="anyJSFunction"> and it works for my application.