I’m using Android, and I’ve created a Webview which nicely opens my HTML page (page “A”).
Now, I want to follow some links I have on page “A”, which go to page “B”.
If I click on a linkl defined with
<a href="page_b.html"> everything is fine, and the Webview behaves just like a normal browser, goinmg to the selected page.
But if I click a link defined as <a href="page_b.html?param=x"> all I get is a “Web page not found”.
The same if I use an anchor like <a href="page_b.html#2">.
How can I pass parameters between different HTML pages within the same Webview?
EDIT:
Nevermind, I managed to pass the parameter I needed using localStorage.
Of course, after a gazillion dry runs, I discovered I had to enable it in the WebView with settings.setDomStorageEnabled(true) 😀
In the end, I discovered I had to set
settings.setDomStorageEnabled(true)in the WebView, and the easiest solution for my problem I found was:In “Page A.html”, I intercept the onClick event of the links, and use localStorage to store the id:
In “Page B.html”, I retrieve the stored id: