Greasemonkey Script Only Runs When Page Is Reloaded
Solution 1:
It's impossible to be sure what's going on, because the target page(s) are behind a pay-wall and their alleged "Free Trial" mechanism blows chunks.
Here are some possible causes of the current behavior:
- The initial request is insecure (http) but redirects to a secure page (https).
- The first page load does a some other kind of redirect to the actual page.
- The target content is in an
<iframe>
that does not load right away. - The target content is AJAXed-in.
- Something exotic that we would need to see the actual page to figure out.
- The initial URL does not really end in
changesets
.
Also, get into the habit of escaping the /
s in the middle of regular expressions. It's not always needed, but it will eventually bite you in the [censored] if you don't.
So the script should use:
// @include /^https:\/\/.*\.rallydev\.com\/.*\/changesets$/
to start, but see below.
Steps to a solution:
Change your
@include
to account for http and the Possibility of trailing space or trailing slash in the URL. Use:// @include /^https?:\/\/.*\.rallydev\.com\/.*\/changesets(?:\s|\/)*$/
- Examine the page with Firebug. Is the content AJAXed-in? Is it in an
<iframe>
? If so, what is the iframe URL, if any? - To also detect AJAX and/or redirects, use Firebug's Net panel and/or Wireshark.
- If possible, provide us with login credentials so that we may see a problematic page.
- Snapshot a problematic page (Save it via Firefox) and link to that HTML and JS in Pastebin.com.
Consider using code like:
if (window.top != window.self) { //--- Don't run on/in frames or iframes.return; }
To have the script run only in (or not in) iframes, as applicable.
If the problem is caused by AJAX delays (or loading of new content), get around that by using the waitForKeyElements()
utility as shown in "Fire Greasemonkey script on AJAX request".
Post a Comment for "Greasemonkey Script Only Runs When Page Is Reloaded"