Greasemonkey script runs only on page reload

I am working on a Greasemonkey script to turn text into links on a Rally page . The script only works fine when reloading the page. If I go to the page in any way (links, browser forward / backward), the script does not start, despite the fact that the Greasemonkey menu shows my script at the bottom, with a check mark.

Here is an example URL:

https://rally1.rallydev.com/#/4745909548/detail/userstory/6138899084/changesets

My matching rule:

/^https://.*\.rallydev\.com/.*/changesets$/

I don’t know if the hash caused the problem, but everything is fine when rebooting.

Not sure where to go from here. Any help is appreciated.

+5
source share
1 answer

, , (-) , " " .

:

  • (http), (https).
  • .
  • <iframe>, .
  • - AJAXed-in.
  • - , , .
  • URL- changesets.

, / . , [], . , script :

// @include  /^https:\/\/.*\.rallydev\.com\/.*\/changesets$/

. .


:

  • @include http URL-. :

    // @include  /^https?:\/\/.*\.rallydev\.com\/.*\/changesets(?:\s|\/)*$/
    
  • Firebug. AJAXed-in? <iframe>? , URL- iframe, ?
  • AJAX / , Firebug Net / Wireshark.
  • , , .
  • ( Firefox) HTML JS Pastebin.com.
  • :

    if (window.top != window.self) {
        //--- Don't run on/in frames or iframes.
        return;
    }
    

    script iframe ( ), .


AJAX ( ), , waitForKeyElements(), "Fire Greasemonkey script AJAX" .

+7

All Articles