Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Possible to use a wildcard in keyword.URL?

95 views
Skip to first unread message

Zeke Sikelianos

unread,
Jul 23, 2007, 10:11:15 AM7/23/07
to
Hi peoples,

I'm trying to configure keyword.URL to execute a javscript function
with the contents of the location bar as its argument. However it
appears that Firefox simply appends the location bar string to the end
of the string in keyword.URL.. And the <a href="http://
kb.mozillazine.org/Keyword.URL">kb article on Keyword.URL</a> seems to
confirm this. I'm wondering if there's a way to get a hold of the of
the contents of a the string as a variable, so it can be used within a
string rather than appended to it, much in the same way that keyworded
quicksearches work..

The following is a proof-of-concept. The javascript gets executed but
of course the location bar string is appended to the end as a comment
so it's not of much use...

keyword.enabled = true
keyword.URL = javascript:alert("test");//

Thinking that was probably a dead end, I also tried wrapping the
javascript function around the location bar contents by setting the
following, but it seems that Firefox doesn't evaluate this constructed
string as javascript, but searches for it as a host name...

keyword.enabled = false
browser.fixup.alternate.enabled = true
browser.fixup.alternate.prefix = javascript:alert("
browser.fixup.alternate.suffix = ");

Anybody have any ideas on how to pull this off? Any help would be
greatly appreciated.

Thanks,
Zeke Sikelianos

Patrick Strasser

unread,
Jul 24, 2007, 4:40:40 AM7/24/07
to
Zeke k schrieb:

> I'm wondering if there's a way to get a hold of the of
> the contents of a the string as a variable, so it can be used within a
> string rather than appended to it, much in the same way that keyworded
> quicksearches work..

Have a look at bookmark keywords:
http://kb.mozillazine.org/Using_keyword_searches

you can write a bookmarklet like:
location: javascript: var param = %s; alert(param);
window.locattion.replace('your_URL_with'+param+'in_between');
keyword: [something short, like "go"]

you would enter "go <your param>" in the location bar.
Note: you can do with param in the bookmarklet what you like, like split
it on spaces to call you bookmarklet with more than one parameter.

Patrick
--
Engineers motto: cheap, good, fast: choose any two
Patrick Strasser <patrick dot strasser at tugraz dot at>
Student of Telematik, Techn. University Graz, Austria

David McRitchie

unread,
Jul 24, 2007, 7:32:25 AM7/24/07
to
"Patrick Strasser" ...

> Zeke k schrieb:
> > I'm wondering if there's a way to get a hold of the of
> > the contents of a the string as a variable, so it can be used within a
> > string rather than appended to it, much in the same way that keyworded
> > quicksearches work..
>
> Have a look at bookmark keywords:
> http://kb.mozillazine.org/Using_keyword_searches
>
> you can write a bookmarklet like:
> location: javascript: var param = %s; alert(param);
> window.locattion.replace('your_URL_with'+param+'in_between');
> keyword: [something short, like "go"]
>
> you would enter "go <your param>" in the location bar.
> Note: you can do with param in the bookmarklet what you like, like split
> it on spaces to call you bookmarklet with more than one parameter.

Misspelled location
but is there a difference between that and using %S (or %s)
as part of the url in a normal keyword shortcut.


Rob Marshall

unread,
Jul 24, 2007, 2:58:50 PM7/24/07
to
Zeke Sikelianos wrote:
> I'm trying to configure keyword.URL to execute a javscript function
> with the contents of the location bar as its argument. However it
> appears that Firefox simply appends the location bar string to the end
> of the string in keyword.URL.. And the <a href="http://
> kb.mozillazine.org/Keyword.URL">kb article on Keyword.URL</a> seems to
> confirm this. I'm wondering if there's a way to get a hold of the of
> the contents of a the string as a variable, so it can be used within a
> string rather than appended to it, much in the same way that keyworded
> quicksearches work..

Set that pref to:
data:text/html,<body onload="alert(document.body.textContent)"><plaintext>


--
Rob Marshall [tH]

Zeke Sikelianos

unread,
Jul 24, 2007, 7:04:37 PM7/24/07
to

Awsome! Thanks Rob.

Zeke Sikelianos

unread,
Jul 24, 2007, 7:07:20 PM7/24/07
to
I also posted this same question in mozilla.supoort.firefox and got
the answer from Rob Marshall. Setting the following works:

keyword.URL = data:text/html,<body
onload="alert(document.body.textContent)"><plaintext>

Zeke Sikelianos

unread,
Jul 24, 2007, 7:07:42 PM7/24/07
to
On Jul 24, 8:58 pm, Rob Marshall <newsmoz...@rdmsoft.com> wrote:

Awsome! Thanks Rob.

0 new messages