• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Chrome userscripts: Why does it execute twice?

Ichinisan

Lifer
This userscript helps my productivity by selecting a filter option automatically on a web system we use a *lot* at work.

Code:
// ==UserScript==
// @match http://blah/blah/*/blahsearch.do
// ==/UserScript==

document.getElementById("status").value="1";

It works. However, I noticed something strange about the way Chrome processes userscripts (?).

While developing the userscript, It was tricky to set up the filter because the web page hides the appropriate URL for that section of the page. To work out the filter and make sure my script was activating, I added an alert box message.

Code:
// ==UserScript==
// @match http://blah/blah/*/blahsearch.do
// ==/UserScript==

alert("userscript active");
document.getElementById("status").value="1";

The filter works, but I get TWO alert messages when it matches the page. Is that normal? I'm guessing it might have something to do with the site / system I'm accessing because it has always been a little glitchy and strange.
 
Back
Top