Monday, August 5, 2024

Re: location.origin is null in GWT 2.11

And adding $wnd might be worth a try too:

public static native void originToConsole() /*-{
console.log("location.origin = " + 
$wnd.location.origin);
}-*/;

On Tuesday 6 August 2024 at 9:49:29 am UTC+10 Craig Mitchell wrote:
Bit of a long shot, but I wonder if it's failing because you have a boolean return type, but you're not returning anything.

Ie: 
public static native boolean originToConsole()

Should be:
public static native void originToConsole()

On Tuesday 6 August 2024 at 1:16:12 am UTC+10 Jens wrote:
You could add GWT.debugger() to your code at a location that fits and then compile your production app using GWT compiler argument -style PRETTY so you can read the JS. If you open Dev Tools of your browser and then load the app and trigger the code in question, code execution should stop at GWT.debugger() and you can take a look if the generated JS code looks reasonable. Maybe a production compile has optimized some code away.

-- J.

Oleg Ravun schrieb am Samstag, 3. August 2024 um 15:23:58 UTC+2:
Hello,
After switching to GWT 2.11 from 2.9 the following code prints null. Though it works in SuperDevMode but when it is built for deployment it produces null. It breaks communications (forth and back) using window.postMessage since it relies on proper origin provided (matching). What could be the reason?
public static native boolean originToConsole() /*-{
console.log("location.origin = " + location.origin);
}-*/;

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 on the web visit https://groups.google.com/d/msgid/google-web-toolkit/11693669-364a-420b-93c8-e57862013d50n%40googlegroups.com.

No comments:

Post a Comment