Greetings!
I have a question which surrounds the use of .js in the context of the Firefox autoconfig scripting scheme. I don’t script every day, so I do hope my question isn’t too basic for the audience.
At any rate, here’s the code context which is showing up in various forms on the Browser Console:
(function() {
setInterval(toggle, 1000);
function toggle() {
… do something …
}
})();
When FF is launched, the console returns: “ReferenceError: setInterval is not defined”
Not to be dissuaded, I tried:
(function() {
window.setInterval(toggle, 1000);
function toggle() {
… do something …
}
})();
…and got back at the next run: “ReferenceError: window is not defined”
Sensing where this might be heading, I took a poke with:
(function() {
var t = window.setInterval(toggle, 1000);
function toggle() {
… do something …
}
})();
…and was reminded: “ReferenceError: window is not defined”
Finally, I tried:
(function() {
var t = setInterval(toggle, 1000);
function toggle() {
… do something …
}
})();
…and watched FF stick its tongue out at me again with: “ReferenceError: setInterval is not defined”
Of relevant note, this runs just fine:
(function() {
toggle();
function toggle() {
… do something …
}
})();
So, that’s my tale of woe in a nutshell…
Any help getting setInterval() to run as expected here is greatly appreciated
Thanks!