url match patterns don't consider GET params after the "?"

646 views
Skip to first unread message

Devin

unread,
Aug 20, 2011, 2:27:27 PM8/20/11
to Chromium-extensions
You can also find this on stack overflow:
http://stackoverflow.com/questions/7133616/chrome-url-match-patterns

I can't seem to get the "?" char to match a question mark in a url.

So essentially
"matches": [ "http://www.google.com/search?* ],
will not match
"http://www.google.com/search?cx=c&sourceid=chrome&ie=UTF-8&q=asdf"

Also,
"matches" : [ "http://www.google.com/search*asdf" ],
doesn't match
"http://www.google.com/search?
aq=f&cx=c&sourceid=chrome&ie=UTF-8&q=asdf"

This has led me to believe that chrome doesn't consider anything after
the "?", that is chrome doesn't consider the GET parameters.

The docs suggest this by the examples http://code.google.com/chrome/extensions/match_patterns.html

Mihai Parparita

unread,
Aug 22, 2011, 7:12:20 PM8/22/11
to Devin, Chromium-extensions
On Sat, Aug 20, 2011 at 11:27 AM, Devin <devin...@gmail.com> wrote:
The docs suggest this by the examples http://code.google.com/chrome/extensions/match_patterns.html

Can you clarify what you mean by this? The docs don't seem to mention query parameters at all, and say that match patterns apply to the scheme, host and path.

Mihai

Zachary “Gamer_Z.” Yaro

unread,
Aug 22, 2011, 7:55:31 PM8/22/11
to Mihai Parparita, Chromium-extensions, Devin

You could try doing a match for http://www.google.com/* and then use JavaScript to check the parameters.

—Zachary “Gamer_Z.” Yaro

> --
> You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
> To post to this group, send email to chromium-...@chromium.org.
> To unsubscribe from this group, send email to chromium-extens...@chromium.org.
> For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.
>

Paolo Casaschi

unread,
Aug 23, 2011, 4:54:01 AM8/23/11
to Chromium-extensions

> > The docs suggest this by the examples
> >http://code.google.com/chrome/extensions/match_patterns.html
>
> Can you clarify what you mean by this? The docs don't seem to mention query
> parameters at all, and say that match patterns apply to the scheme, host and
> path.

I also had issues with match patterns and URL parameters.
I wanted to have a context menu added to links where the path ends
with a ".pgn" extension, with or without additional URL parameters. In
other words, I wanted to match both http://example.com/file.pgn and
http://example.com/file.pgn?something=somevalue

I tried with this match pattern ["*://*/*.pgn"] but it did not match
http://example.com/file.pgn?something=somevalue

Finally, this match pattern worked ["*://*/*.pgn", "*://*/*.pgn?*"],
however this is also matching this URL
http://example.com/not-pgn-extension.html?something=somevalue.pgn and
I did NOT want to match this (I'm only interested when the path ends
with the extension).
I settled for this, matching some unwanted URL being the lesser evil.

It looks like when they refer to "path" into the documentation they
also include the URL parameters.

Have this issue open on the subject: http://crbug.com/84024 but it has
been open for a while, a possible workaround is suggested if/when
another bug where to be fixed.



Reply all
Reply to author
Forward
0 new messages