从浏览器地址栏执行Javascript方法 - GWT [英] Execute Javascript method from browser address bar - GWT

查看:170
本文介绍了从浏览器地址栏执行Javascript方法 - GWT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  javascript我试图通过在浏览器的URL /地址栏上执行这个命令来执行我的web应用程序中的Javascript: :window.alert( '试验');无效(0); 

然而,没有任何反应,警报框没有显示出来?原因可能是该应用程序在DevMode中运行?

解决方案

我相信大多数浏览器拒绝执行 javascript:来自URL栏的URL作为一项安全措施(网页上有一些消息 - 脸书 - 告诉用户复制粘贴 javascript:触发XSS的URL栏)。尽管他们不想打破小书签,所以可以将该代码放在书签中;但是打开浏览器的JS控制台并在那里键入该命令会容易得多。



无论如何,这不是由于GWT的DevMode。


I'm trying to execute Javascript on my web application by executing this on the browser URL/address bar:

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

However, nothing happens and the alert box is not showing up? Could the reason be that the app is running in DevMode?

解决方案

I believe most browsers refuse to execute javascript: URLs from the URL bar as a safety measure (there's been messages on the web –esp. Facebook– telling people to copy-paste a javascript: URL to their URL bar that triggered an XSS). They didn't want to break bookmarklets though, so you can put that code in a bookmark; but it's much easier to just open the browser's JS console and type that command there.

Anyway, it's not due to GWT's DevMode.

这篇关于从浏览器地址栏执行Javascript方法 - GWT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆