问题描述
有没有一种方法可以直接从地址栏中执行vbscript代码?我正在寻找与JavaScript相似的东西.
Is there a way I can execute my vbscript code directly from my address bar? I am looking for something similar to what we have for JavaScript.
另一方面,从浏览器运行vbscript是否不是主要的安全风险,因为它在运行时比JavaScript具有更多的特权?
On a side note, isn't running vbscript from browser a major security risk, as it has more privileges while running than JavaScript?
推荐答案
与Java脚本几乎相同,但效果并不理想: vbscript:replace(document.body.innerhtml,地址栏",三明治")
Pretty much the same way as Javascript it just doesn't work very well:vbscript:replace(document.body.innerhtml,"Address Bar","sandwich")
本质上,这将导航到一个页面,该页面的源代码等于该函数调用的返回值.
Essentially this navigates to a page that has source equivalent to the returned value of the function call.
我做任何没有返回结果的命令的尝试都导致页面错误...
Any attempt I've made to do a command that has no return result has caused an error on the page...
至于你的旁注,不是真的.浏览器限制了脚本可以执行的操作.例如,您可以通过 CreateObject("whatever")
使用VBS自动创建对象,但是如果从浏览器运行,则会提示您允许使用Active-X控件.(您可以使用Javascript做同样的事情)
As for your side note, not really. The browser limits what scripts can do. For instance, you can automatically create objects using VBS via CreateObject("whatever")
, but if run from a browser you will be prompted to allow Active-X controls. (You can do the same thing with Javascript)
这篇关于从IE地址栏中执行Vbscript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!