Hi,

I'm working with a web page that calls another page using Javascript.
The content of the called page is not included in the main page but it
is read by the Javascript to decide how it should continue processing.
I needed to write a GM script to change the value of an HTML element
in the returned content to force the decision the Javascript makes.

Writing the script was easy enough. To simplify development I called
the 'included' page (that the Javascript normally invokes) directly in
Firefox to test the script and it worked fine. However, when I call
the actual page containing the Javascript the page is called by the
Javascript, but the GM script is not executed. Using the Live HTTP
Headers plugin I can see that the Javascript is calling the same URL I
added to the @include attribute of the GM script but the script is
still not executed.

Should GM be able to execute scripts on URLs invoked by Javascripts or
just on URLs referenced directly in the page's HTML?

Here is my script. It should match the URL http://myfirm.com/checker.
The page at the URL contains an HTML element with either the text
'NOK' or 'OK' in it. My script updates it to always contain 'OK'.

// ==UserScript==
// @name           resultUpdater
// @namespace      http://myfirm.com
// @description    Force result to always be OK
// @include        http://myfirm.com/checker
// ==/UserScript==

var expression = '/html/body/result';
var status = document.evaluate(expression, document, null,
XPathResult.FIRST_ORDERED_NODE_TYPE, null);
if(status.singleNodeValue != null) {
        status.singleNodeValue.textContent = 'OK';
}

When the Javascript in the page I call invokes http://myfirm.com/checker
the GM script is not executed. However, it is executed if I invoke
http://myfirm.com/checker in the browser directly.

Does anyone have an idea what the problem might be? Does GM support
what I'm trying to do? I appreciate any help you can offer. I've so
far been unable to find any similar entries about the problem here or
in the docs.

Thanks

Steve


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to