JS reach elements in other pages

Is it possible to have a JS function reach ux elements on other pages than the one where it resides. For example:

In PageX.ux:

<JavaScript>
theElement.goto(variable);
</JavaScript>

In PageY.ux:

<WebView ux:Name="theElement">

Yes, if you pass the element in as a ux:Dependency. Very much like we usually do with router.

Thx.

So in above PageX.ux add xyz?

(sorry still bending my mind to the new logic)

Sorry, I don’t know what xyz stands for. The docs I linked explain how to pass dependencies.

Sorry, the code got lost :confused: should have been:

So in above PageX.ux add :

<Page>
<xyz ux:Dependency="theElement" />

What should xyz be for PageX.ux to be able to reach “theElement” in PageY.ux through JS?

It should be exactly what type the original instance is. So, if it’s a WebView, then <WebView ux:Dependency="theElement" />.

That is explained in the docs I linked, too.