Include not working when location hash is present

325 views
Skip to first unread message

Mike

unread,
Jun 22, 2009, 5:16:19 PM6/22/09
to greasemonkey-users
Hey all, my include string doesn't want to work when there is a
location hash present.

Here's my include, for I want to run the script whenever a .htm
document is loaded.

@include http://website.com/*.htm

This works fine. Say you visit website.com/foobar.htm, the script
will execute. Note that the script makes use location hashes by
dynamically generating links.

Lets say you now visit website.com/foobar.htm#hash-one

The script will not execute, because of the hash.

I tired setting the include too:

@include http://website.com/*.htm*

But that didn't work. Anyone else encounter this issue? Any
suggestions or ideas?

Anthony Lieuallen

unread,
Jun 23, 2009, 9:45:58 AM6/23/09
to greasemon...@googlegroups.com
On 6/22/2009 5:16 PM, Mike wrote:
> Hey all, my include string doesn't want to work when there is a
> location hash present...

This definitely works. Please provide an exact script, and the exact
url that it does not (and does) work for.

Mike

unread,
Jun 23, 2009, 12:30:15 PM6/23/09
to greasemonkey-users
The scripts for our company intranet, so I alter the domain name, but
the rest is identical.

// @include http://collab.companysite.com/gm/document*.htm*

If I go to http://collab.companysite.com/gm/document-1.9.207738/12009022414464972537961.htm_chg.htm,
the script will execute just fine

If I go to http://collab.companysite.com/gm/document-1.9.207738/12009022414464972537961.htm_chg.htm#foobar,
the script will not execute

Matt Sargent

unread,
Jun 23, 2009, 4:23:14 PM6/23/09
to greasemon...@googlegroups.com
By "will not execute", do you mean it doesn't function, or it's not active? Two very different things. Right-click on the monkey icon to see if the script is active.

Mike

unread,
Jun 23, 2009, 10:25:33 PM6/23/09
to greasemonkey-users
the script does not show in the list when a visit a page with a hash.

On Jun 23, 4:23 pm, Matt Sargent <matt.sarg...@earthlink.net> wrote:
> By "will not execute", do you mean it doesn't function, or it's not
> active? Two very different things. Right-click on the monkey icon to see
> if the script is active.
>
> Mike wrote:
> > The scripts for our company intranet, so I alter the domain name, but
> > the rest is identical.
>
> > // @include        http://collab.companysite.com/gm/document*.htm*
>
> > If I go tohttp://collab.companysite.com/gm/document-1.9.207738/1200902241446497...,
> > the script will execute just fine
>
> > If I go tohttp://collab.companysite.com/gm/document-1.9.207738/1200902241446497...,

qufighter

unread,
Jun 29, 2009, 6:17:19 PM6/29/09
to greasemonkey-users
Are you sure its not an https issue? Its possible something else has
changed in the URL you are not accounting for? Otherwise you might
try simplifying to *.ht* or *.htm_* or just to http://collab.companysite.com/gm/document*

More likely than not the hash is completely ignored by GM pattern
matching for includes although I have no idea, but all my scripts work
fine if I reload the same URL with a hash added on

qufighter

unread,
Jun 29, 2009, 6:24:11 PM6/29/09
to greasemonkey-users
also may be pertinent to note if the hash is changed via script, the
script not automatically re-executed, you would have to monitor for
hash change and call your function again. If you open the second in
link in a new tab it should execute your code however since the page
itself might be monitoring for hash change and then load something
else after your script operates, you would have to account for that
somehow (possibly set a timeout after document loaded before your
script exeutes)
Reply all
Reply to author
Forward
0 new messages