Search code examples
javascripthtmlwebformsjavascript-injection

Issue filling in form with javascript


I'm trying to write a javascript script which tries to fill in an ASP form. The problem is that when I set, for example, the username, the browser loads a new HTML with nothing but the value I've just set. This happens in 2 <input> and 1 <select> fields, just the same thing.

Could someone tell me what could be happening?

Thanks in advance


Solution

  • Finally I've found the answer to the problem. I thought about posting it here cause it could be useful for some people that could be having the same problem.

    So when I wrote something like:

    javascript: document.getElementById('username').value="user1";

    The web was redirecting me to another page, completely blank, just showing user1 on it.

    I found void(); javascript function, what it makes is executing the code inside it without having a return value (not showing the page in my case). And this code, made the trick:

    javascript: void(document.getElementById('username').value="user1");

    Hopefully it will be useful for someone else