URI Fragments and ID Attributes

When coding straight HTML, an

id

attribute can be added to indicate a special section of the DOM to which and element can be linked.

However, because of the AJAX loading, HashBang (!#) URLs, and other reasons within Vaadin, it is impossible to create this type of inner element navigation with URLs. I have two questions:

  1. Is there a way to navigate to elements with

    id

    attributes within the DOM?
  2. If not, is there another way that widgets and other components can be directly linked to?

Thanks in advance!

Hi Burke
I think 1. is possible with JavaScript: you first need to get hold of the element and then invoke its scrollIntoView() method:

var elementToScrollTo = document.getElementById(elementId);
elementToScrollTo.scrollIntoView();

You can use JavaScript.eval() on the server side to have above code executed in the browser. Of course this adds overhead of client-server roundtrip but I think it’s fine.