admin管理员组文章数量:1221020
I know you can use Firebug in the DOM view to edit JavaScript variables BUT... is there a way I can use (anything else) to edit live JavaScript that is embedded in a HTML page?
Like this kind that is in a .html page:
<script type="text/javascript>
// code here
</script>
Thanks.
I know you can use Firebug in the DOM view to edit JavaScript variables BUT... is there a way I can use (anything else) to edit live JavaScript that is embedded in a HTML page?
Like this kind that is in a .html page:
<script type="text/javascript>
// code here
</script>
Thanks.
Share Improve this question asked Jan 21, 2011 at 22:00 testtest 18.2k67 gold badges172 silver badges245 bronze badges 1- 1 You could use Opera. Opera allows editing of inline JS and JS files. After you soft reload the page, your changes will be applied. Right click > Source > Make changes > Apply Changes. – XP1 Commented Jun 25, 2012 at 15:49
10 Answers
Reset to default 3bookmarklets
From the Wikipedia entry
A bookmarklet is an applet, a small computer application, stored as the URL of a bookmark in a web browser or as a hyperlink on a web page. The term is a portmanteau of the terms bookmark and applet. Whether bookmarklet utilities are stored as bookmarks or hyperlinks, they are designed to add one-click functionality to a browser or web page. When clicked, a bookmarklet performs some function, one of a wide variety such as a search query or data extraction. Usually the applet is a JavaScript program.
And as a related note not trying to spam or anything I created a bookmarklet generator to help me create bookmarklets easier.
You could use Opera 12. Opera 12 allows editing of inline JS and JS files. After you soft reload the page, your changes will be applied. Right click > Source > Make changes > Apply Changes.
Firebug has a console (the first tab of the firebug window) where you can write JS code and execute it in the current page. Suppose the webpage has a function called myFunc
defined and you want to override it: executing the following in the console will do the trick.
myFunc = function(/* function arguments here */) {
/* new function body here */
}; /* notice the ; */
and to see the the current version of a function you can execute
uneval(myFunc);
this will print out the current myFunc
note: I think that by default the console comes with a single-line input box, but somewhere in the options you can switch to a multi-line input box. When in multi-line, goes to a new line, + executes the code.
Eloquent javascript has a console type window in the bottom (click the small arrow on the bottom right side). This might be what you're looking for. The exact term for what you means is an REPL, a Read-Evaluate-Print loop.
Well, you won't be able to edit JavaScript code that has been loaded into your browser, except with the help of that same browser. That basically means through a plug-in and I'm not aware of any plug-ins other than FireBug that will let you do that.
Is there a specific reason you can't/won't use FireBug?
Firebug itself has a non-plugin-dependent "lite" version. If you examine the source code of that, you can find out how to implement a large subset of the Firebug functionality.
http://getfirebug.com/firebuglite
Chrome also has a console window that can be activated once you inspect the element (or page). From there you can write simple javascript. It even has a pretty decent debugger.
If you go to Tools/Developer Tools on Chrome, you will find a space where you can change all the code from html, to javascript and CSS, live on your browser. Obviously it does not generate a real change on the page, just in the way you see it, since it just can be edited for the administrator of the website
You able to edit inline script tags with Firebug's HTML view. Just select script tag, and then press "Edit" button. After editing, press "Edit" button again to apply changes.
Firefox' Greasemonkey plugin wasn't mentioned yet. That way you can store, re-use and share youre scripts. I'm not 100% sure you can run your code in the exact same scope as the page's code OOTB. Inserting arbitrary script tags is still possible, though.
本文标签: htmlEdit JavaScript blocks of web page liveStack Overflow
版权声明:本文标题:html - Edit JavaScript blocks of web page... live - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1739354422a2159534.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论