0

I'm using Tampermonkey v 3.6.3737.80 on Chrome Version 33.0.1750.46 beta-m on Windows 7. I have a couple of custom userscripts defined in Tampermonkey, so that the headers are as follows:

// ==UserScript==
// @name       MyScript(s)
// @version    0.1
// @description  enter something useful
// @include      http://domain.com/*
// @include      http://www.domain.com/*
// @copyright  2012+, You
// @require http://code.jquery.com/jquery-1.10.2.min.js
// ==/UserScript==

Which, in theory, should work on all pages of the form http://domain.com/* with or without www. Generally, the scripts work as they should. However, on certain pages within the site, all of the tampermonkey scripts which are supposed to work on the site seem to stop working. After manually reloading the page the scripts sometimes work again, otherwise a few more reloads will fix the problem. The problem is I don't know why this is happening; the code appears to be sound since it works after refreshing with no other changes. Would it be something to do with chrome and/or tampermonkey?

EDIT:

The script navigates through one of the webpages by using a jQuery trigger, $('#id').trigger('click'). Clicking this myself does change the URL of the page, which leads me to assume that it's not being done through AJAX? So, when the script does the trigger, the tampermonkey scripts I have on the next page do not work. However, if I refresh that page, the do work.

What I've also noticed is that if I have the dev console open in chrome (CTRL + SHIFT + I) that it works fine for some reason. Any idea why this may be?

EDIT v2:

Don't know why it was working with the dev console open, it seems to have stopped doing so and is now again working with the intermittent functionality as described with edit 1, regardless of the console being open or not.

Vasu
  • 1,090
  • 3
  • 18
  • 35
  • Hey Brock. I've added a little more info about the functionality - the webpage is a little large to provide on here and I figure that the script isn't worth anything without the webpage. – Vasu Jan 28 '14 at 04:56
  • 1
    You're now describing a textbook AJAX scenario. Use one of the AJAX aware techniques, like [this one](http://stackoverflow.com/a/15052467/331508). – Brock Adams Jan 28 '14 at 07:02

0 Answers0