lundi 25 juillet 2016

How do I use an HTML DOM Event on new tab load?

I have a custom homepage which loads upon opening a new tab in Firefox. I want to reposition the caret on load but I can't find the event which will handle this on a tab load.

The window.onpageshow and window.onload events do not work when the page is loaded from a new tab event, but work fine on a refresh or similar. Throwing the event in with an element has no effect either, such as:

<body onload="blah()"

Is there a way to call my cursor reposition function when the page loads in this manner?

PS. This is my first time ever working with HTML or Javascript - I may have have improperly called the function in the body element. Script is as follows:

<script type="text/javascript">
window.onpageshow = function blah() {
    setCursor(document.getElementById('sbar3'), 5, 5)
}

Aucun commentaire:

Enregistrer un commentaire