Execute Javascript method from browser address bar - GWT

I am trying to execute Javascript in my web application by executing it in the url / address bar of the browser:

javascript:window.alert('test');void(0); 

However, nothing happens and the warning window does not appear? Could the reason that the application is running in DevMode?

+12
javascript gwt
Sep 13 '13 at 9:01
source share
2 answers

I believe most browsers refuse to execute javascript: URLs from the URL string as a security measure (there were Facebook posts on the network telling people to copy javascript: URLs into their URL panel to invoke XSS). They did not want to break bookmarklets, so you can bookmark this code; but it’s much easier to just open the browser JS console and type this command there.

Anyway, this is not due to the GWT DevMode.

+11
Sep 13 '13 at 9:26
source share

You can write your javascript code inside a block, like this

 javascript:{alert("ok");} 
+14
May 02 '14 at 6:44
source share



All Articles