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 (eg 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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.