I add the lib to my client module:
<dependency>
<groupId>com.google.elemental2</groupId>
<artifactId>elemental2-dom</artifactId>
<version>1.2.3</version>
</dependency>
<groupId>com.google.elemental2</groupId>
<artifactId>elemental2-dom</artifactId>
<version>1.2.3</version>
</dependency>
And then try to use it:
DomGlobal.history.pushState(myUrl, "", myUrl);
And got the error:
[ERROR] Line 190: No source code is available for type elemental2.dom.DomGlobal; did you forget to inherit a required module?
So, I added:
<inherits name="elemental2.dom.DomGlobal"/>
to my gwt.xml, and got the error:
[ERROR] Unable to find 'elemental2/dom/DomGlobal.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
Any idea what I'm doing wrong?
Thanks.
On Wednesday, 4 December 2024 at 5:05:41 am UTC+11 Colin Alworth wrote:
First... you should update this to use jsinterop - consider just adding elemental2-dom to your project and calling DomGlobal.history.pushState(new Object(), "", historyRewrite); in plain Java?To answer the question more directly, you probably need to change "window" to "$wnd" to access the actual outer window. Your current code, as written, is technically attempting to change the URL of the iframe that the app is loaded in.On Tuesday, December 3, 2024 at 11:43:00 AM UTC-6 Lonzak wrote:I successfully updated GWT from 2.10.1 to 2.12.1.In Firefox everything works perfectly however not in chrome based browsers. When I try toexecute the following code:public static native int setHistory(String historyRewrite) /*-{
window.history.pushState({}, '', historyRewrite);
}-*/;
Error:SEVERE: (SecurityError) : Failed to execute 'pushState' on 'History': A history state object with URL 'https://company.url/home' cannot be created in a document
with origin 'https://company.url' and URL 'about:blank'.
com.google.gwt.core.client.JavaScriptException: (SecurityError) : Failed to execute 'pushState' on 'History': A history state object with URL
'https://company.url/home' cannot be created in a document with origin 'https://company.url' and URL 'about:blank'.If I revert to GWT it works again.Any idea what changed (and how to fix it)?Is the script maybe loaded before the document is fully loaded?Thanks!
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/9bd9ceb5-0340-4b89-a2a0-cc1ac0644659n%40googlegroups.com.
No comments:
Post a Comment