I want to submit a form when entering a specific address on the url bar manually , is it possible? something like this
if(urlbar== "mylink.com/admin" && event.keyCode === 13)
{
myform.submit();
}
I want to submit a form when entering a specific address on the url bar manually , is it possible? something like this
if(urlbar== "mylink.com/admin" && event.keyCode === 13)
{
myform.submit();
}
You cannot detect events in the browser's address bar.
You cannot detect the URL the user is about to navigate to if the navigation is caused by something outside the page (e.g. you could use a click
event on an a
element and then read it's href
but you could not use onbeforeunload
and get the URL typed into the address bar).
Can use an interval.
setInterval(function() {
if(location.href == "mylink.com/admin") {
myform.submit();
}
}, 1000);