chrome/firefox-如何运行 javascript 命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9687410/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
chrome/firefox- how to run a javascript command
提问by Arvind
I am using a gwt based ui design framework (called GXT). In the docs for this framework, it is mentioned that running "javascript:isc.showConsole()" when the app is running, will open the developer console in browser.
我正在使用基于 gwt 的 ui 设计框架(称为 GXT)。在此框架的文档中,提到在应用程序运行时运行“javascript:isc.showConsole()”将在浏览器中打开开发者控制台。
However when I run this in Chrome it instead does a google search for the command- in firefox it simply does not work.
但是,当我在 Chrome 中运行它时,它会在 google 中搜索命令 - 在 firefox 中它根本不起作用。
How do I execute this javascript in firefox or chrome--
我如何在 firefox 或 chrome 中执行这个 javascript--
javascript:isc.showConsole()
回答by Rob W
Bookmarklets cannot be executed in the location bar/omnibox any more.
不能再在位置栏/多功能框中执行书签。
You have to bookmark the javascript:
link before it can be executed.
A better solutionis using the built-in Developer tools, in which code can be pasted and executed in the current page:
您必须先为该javascript:
链接添加书签,然后才能执行该链接。
一个更好的解决方案是使用内置的开发者工具,其中的代码可以粘贴和执行当前页面:
- Firefox: CtrlShiftK- See Using the web console.
- Chrome: CtrlShiftJ- See Developer tools.
- Firefox: CtrlShiftK- 请参阅使用 Web 控制台。
- Chrome:CtrlShiftJ- 请参阅开发人员工具。
回答by greyghostie
In Chrome, you add a tab, open bookmarks - click Other Bookmarks, right click in the bookmarks area, click add new page - and paste the URL.
在 Chrome 中,您添加一个选项卡,打开书签 - 单击其他书签,右键单击书签区域,单击添加新页面 - 并粘贴 URL。
In Firefox, just manage your bookmarks, click on the folder, right click in the bookmarks section and click New Bookmark.
在 Firefox 中,只需管理您的书签,单击文件夹,右键单击书签部分,然后单击新建书签。
回答by Envil
You have to put the command in the URL of the very SmartGWT application that you're developing, not any blank page.
Making it become a bookmark bar is a good idea, click that bookmark when you're opening the application will open the console for you.
您必须将命令放在您正在开发的 SmartGWT 应用程序的 URL 中,而不是任何空白页面。
让它成为书签栏是个好主意,当您打开应用程序时单击该书签将为您打开控制台。