Gale Andrews

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromGale Andrews
ToMe
SubjectContext menu search Google: can it open search result in same window?
Date17 May 2004 22:56
Mark

'Google search' context menu tool

I have gratefully used this to enhance Avant Browser (an IE clone with
extra features but still some gaps), a minor problem being the search
window opens IE proper which of course I am not in. Can the script be
amended to open in the same window so remaining in Avant (have tried
replacing 'blank' with 'self' but new window in IE proper still opens.)

Thanks

Gale Andrews
FromMe
ToGale Andrews
SubjectRe: javascript Context menu search Google: can it open search result in same window?
Date18 May 2004 09:27
sure, but unfortunately not as easy as a simple name change.

_self is actually the name reference of the hidden page that is doing the
processing, and you need a pointer back to the original page, which is
window.external.menuArguments
also, it may be in a frameset, so that would make it
window.external.menuArguments.top

so, what you need to do is replace the line

window.open('http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF8&q=' + escape( searchText ),'_blank');

with

window.external.menuArguments.top.location.href = 'http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF8&q=' + escape( searchText );

hope this helps


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromGale Andrews
ToMe
SubjectRe: javascript Context menu search Google: can it open search result in same window?
Date18 May 2004 13:14
Mark
 
Thank you for your detailed reply which not only works but which helped me
to understand the procedure more.
 
Gale Andrews
FromGale Andrews
ToMe
Subjectcontext menus search for selected text
Date8 June 2004 3:32
Mark

apologies if I have altererd this myself in error, but I just noticed
when wanting to search for selected text on google using your utility
that this feature does not show on the right click context menu when the
selected text is actually a link. What I would like is for the web
search to appear on context menu when selecting any text including if it
is a link . In the registry the contexts key for searching selected text
on web is currently binary 10. Do you know what it could be set to so
the item appears when selecting link text as well. I know it can appear
with any right click context by not setting a value but that is not
quite what I want .

Thank you
FromGale Andrews
ToMe
SubjectRe: context menus search for selected text
Date8 June 2004 8:55
Gale,

Just as a warning, it says binary 10, but that is actually a hex number -
binary 00010000 (just one of the quirks of how the registry works).

Ok, here's the problem. The way you define that menu uses only an OR
statement on the binary values, so it is possible to say 'show this for
selected text AND for links', but it is not possible to say 'show this for
selected text AND links that are also selected'.

See Microsoft's documentation for more information:
http://msdn.microsoft.com/workshop/browser/ext/tutorials/context.asp

What that means is that if you were to make it appear for links as well, it
would always appear for links, even if you have not selected any text.
Trying to use it on a link that is not selected will do nothing at all.
Still, if you are happy with that, edit the installer google.reg file to
replace the line:
"Contexts"=hex:10
with:
"Contexts"=hex:30
Then run the installer again.


Hope you find this useful

Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromGale Andrews
ToMe
SubjectRe: context menus search for selected text
Date 9 June 2004 3:35
Mark
 
Thanks for your usual detailed reply.
Yes I have edited contexts to 30 and will have to put up with the
selection items showing when I merely right click on a link without
selecting its text (something I rarely do.)
 
In this respect I notice Mozilla Firefox gets it dead right ie selecting
text irrespective if it's a link gives the view source of selection and
search on the selected text but these two items don't appear when right
clicking a link without selecting text.  This does not appear to be done
explicitly by linking to HTML documents so I suppose the script is built in
and not adaptable to IE based browsers? I would prefer Mozilla or Opera in
many ways, but sadly there is a significant minority of pages they won't
display properly or at all, I suppose because the pages are coded using the
Windows version of Java which the Gecko browsers seem almost proud to say,
we don't support it?.. OTOH I have never found a page that IE won't display
in a functional fashion. 
 
Regards 
 
 
Gale Andrews
FromGale Andrews
ToMe
SubjectRe: context menus search for selected text
Date10 June 2004 8:15
>  This does not appear to be done explicitly by linking to HTML documents so I suppose 
> the script is built in and not adaptable to IE based browsers?

I may be wrong about this, but I believe that mozilla/firefox extensions
such as this are done using a cross between XUL, RDF and JavaScript. The
javascript part could probably be reused (with some significant changes),
but there is no need since I have already written that part. The part that
IE gets wrong is the RDF/XUL (whichever) part, which cannot be converted
into IE talk since IE uses CLASSID registry keys and parts of the compiled
binary. I do not think there is anything that can easily be done to change
IE's behaviour in this case.
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.