I know it’s possible to run JavaScript from the address bar, but are there any DOM events or exposed objects that let you interact with it through script?
I imagine not for security reasons but for example, are there any events such as onfocus that could let you know when a user is using the address bar and not the webpage?
Or perhaps there are methods available elsewhere on the page which one could use to deduce that the user is typing in the address bar. Similarly, I know you can do ugly things like history.go(-1) but can you tell when the ‘back’ button is clicked?
That is not possible, for very obvious security reasons.
One exception is the
hashchangeevent, which is triggered every time that the location hash changes.