markzzz
markzzz

Reputation: 47945

How can I edit JS from browser?

Suppose I get, on a page, this simple 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? I use Firebug... I need these details to test a security-side of my own application.

Upvotes: 0

Views: 140

Answers (1)

Royi Namir
Royi Namir

Reputation: 148524

enter image description here

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

enter image description here

myvar is false ( beginning)

enter image description here

now set it to true :

enter image description here

and click and see : enter image description here

Upvotes: 4

Related Questions