简体   繁体   English

如何从浏览器编辑JS?

[英]How can I edit JS from browser?

Suppose I get, on a page, this simple html/script : 假设我在页面上得到了这个简单的html / script:

<a id="hey" href="#">try</a>

var myvar=false;

$('#hey').click(function () {
    if(myvar)
    {
        alert("Well! You change it!");
    }
});

clicking on the link, I won't never get the alert show up! 点击链接,我将永远不会显示警报! So, how can I edit JS (changing myvar=true; ) on browser? 那么,如何在浏览器上编辑JS(更改myvar=true; )? I use Firebug... I need these details to test a security-side of my own application. 我使用Firebug ...我需要这些详细信息来测试自己应用程序的安全性。

在此处输入图片说明

first warp with : 第一次扭曲:

<script type="text/javascript">
var myvar=false;

$('#hey').click(function () {
    if(myvar==true)
    {
        alert("Well! You change it!");
    }
});
</script>

edit 编辑

I readlly think you have a problem somewhere else. 我很乐意认为您在其他地方遇到了问题。 ... ...

take this code and save it in a file. 获取此代码并将其保存在文件中。

this is what youll get 这就是你会得到的

在此处输入图片说明

myvar is false ( beginning) myvar为假(开头)

在此处输入图片说明

now set it to true : 现在将其设置为true:

在此处输入图片说明

and click and see : 然后单击以查看: 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在服务器发送到浏览器之前编辑服务器发送的js文件? - How can I edit a js file sent by the server before it gets to my browser? 如何在IOS上的JS中检测何时可见浏览器? - How can I detect when browser is visible from JS on IOS? 如何从浏览器控制台重新加载 modified.js 文件? - How can I reload modified .js files from the browser console? 如何从浏览器扩展程序/用户脚本中编辑聚合物铁清单并对其进行排序? - How can I edit and sort a Polymer iron-list from a browser extension/userscript? 我如何从视图中编辑Gruntfile.js以包含build:js请求? - How can i edit my Gruntfile.js to include build:js requests from a view? 如何在浏览器中编辑 javascript,就像我可以使用 Firebug 编辑 CSS/HTML 一样? - How can I edit javascript in my browser like I can use Firebug to edit CSS/HTML? 如何使用JS检测浏览器版本? - How can I detect the browser version with JS? 如何从JS文件编辑manifest.json文件? - How can I edit a manifest.json file from a JS file? 我可以编辑浏览器对话框的按钮吗? - Can i edit the buttons of a browser dialogs? 如何在JS中编辑html节点的子节点? - How can I edit the child of html node in JS?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM