Reputation: 427
I'm using a Xamarin Forms WebView
and set the html as string
to the "Html" Property of HtmlWebViewSource
(which then is set to the WebView.Source).
The html contains anchors (<a href="#..."
) to jump target inside the same html document. This works on iOS 8,9,10, but not in iOS 11, ie. you click on the link but nothing happens.
Any idea how to overcome this limitation ?
Upvotes: 0
Views: 351
Reputation: 427
Just found it myself: insert this js function under <head>
:
<script type="text/javascript" language="javascript">
function goToAnchor(anchor) {
var element_to_jump_to = document.getElementById(anchor);
element_to_jump_to.scrollIntoView();
return false;
}
</script>
Then instead of
<a href="#myAnchor1">Some caption</a>
use this
<a href="#" onclick="goToAnchor('myAnchor1'); return false;">Some caption</a>
where myAnchor1 is some element to jump to with id="myAnchor1"
Upvotes: 2