Have you tried to attach an event listener (DOM.addEventListener()) to 
these anchors and call ClickEvent.preventDefault() when you click on them? 
That could suppress the history change and you can scroll your html 
document yourself by reading the href attribute and searching the anchor 
you need to scroll to. But don't forget to remove the event listener if you 
don't need the html anymore.

If ClickEvent.preventDefault() does not work you need to modify your 
anchors to

<a data-scrollTo="chapter1" class="linkStyle">Chapter 1</a>

or use <div> instead of <a> because you can't use href anyways. So remove 
the href attribute and put the information in a custom attribute. Your 
click handler would use the custom attribute to get the information where 
to scroll to.

Obviously you have to do the scrolling yourself (Element.scrollIntoView()). 

In modern browsers you could maybe use HTML5 pushState instead of hash 
tokens for history management. In that case you probably don't have to 
change anything in your html document. But if you want IE compatibility 
this is not an option.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/aYqzC1JSGYwJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to