Skip to content Skip to sidebar Skip to footer

Can I Auto-press A Button On A Webpage With A Url?

I want to be able to auto click this form button on my webpage: by modifying the Url to the page

Solution 1:

I created a jsbin for you to checkout. If you visit the url with #click_approved in the url it will trigger the click. I added an onclick="alert('woohoo!')" so you could see it working.

http://jsbin.com/enuhox/1 <--- no click triggered

http://jsbin.com/enuhox/1#click_approved <--- click triggered

once on jsbin just click 'edit' in the upper right to see the code.

Solution 2:

If the <form>method-attribute is GET it is easy. Just use something like:

http://www.yourdomain.com/page?apv=Approve

If the used 'method' is something else, like POST. It is not possible by solely providing a 'special' URL.

Solution 3:

I am not sure about what exactly is the reason you need to 'auto-click' a button due to not seeing your context code. But I assume you want to submit hidden data fields through this form to redirect you to a page or somehow submit data...

An easier method would just be using the onLoad() function to call a javascript call to submit what-ever you need to get done. Ex:

<bodyonLoad="my_function();">

and

<scripttype="text/javascript">function my_function {
//submit data and redirect
}
</script>

Solution 4:

for this, can be auto-press using form

<button type="button">ok</button>

Post a Comment for "Can I Auto-press A Button On A Webpage With A Url?"