Invoking the browser's find dialogue

G

Gordon

Just a quickie. Is there a way to cause a browser to open it's
find... dialogue in response to an event, say a click on a button?

The idea is that there's a list of addresses that a client has used
for delivery in the past, but in some cases this list can be rather
long, and a lot of clients don't know about the browser find in page
dialogue.

I'd imagine getting the browser to generate it's own ctrl-f event
would be impossible, but is there a way to trigger the window (or
search bar in Firefox's case) directly from within javascript? My
search of the group turned up results that only seemed pertinent to
very old browsers, and i need something that will work in IE6 and
FireFox as a bare minimum.
 
K

Keith

Just a quickie. Is there a way to cause a browser to open it's
find... dialogue in response to an event, say a click on a button?

I very much doubt that such a mechanism exists...
The idea is that there's a list of addresses that a client has used
for delivery in the past, but in some cases this list can be rather
long, and a lot of clients don't know about the browser find in page
dialogue.

You could add a footnote to this page, suggesting "use Edit->Find in
this page"...
I'd imagine getting the browser to generate it's own ctrl-f event
would be impossible, but is there a way to trigger the window (or
search bar in Firefox's case) directly from within javascript? My
search of the group turned up results that only seemed pertinent to
very old browsers, and i need something that will work in IE6 and
FireFox as a bare minimum.

Not exactly the mechanism you ask for, but this page:
http://www.nsftools.com/misc/SearchAndHighlight.htm
prompts for a string, then highlights it in the page.

K.
 
T

Thomas 'PointedEars' Lahn

Gordon said:
Just a quickie. Is there a way to cause a browser to open it's
find... dialogue in response to an event, say a click on a button?

The idea is that there's a list of addresses that a client has used
for delivery in the past, but in some cases this list can be rather
long, and a lot of clients don't know about the browser find in page
dialogue.

My search of the group turned up results that only seemed pertinent to
very old browsers, and i need something that will work in IE6 and
FireFox as a bare minimum.

Maybe you are looking for

window.find()

That is a feature of DOM Level 0 and therefore supported not only in
Netscape 4.x, the "very old browsers" you probably mean, but also in
Gecko-based UAs like Firefox. See also

http://www.google.com/search?q=window.find+IE

Use the code you find with great care; where attempts at browser detection
are made (look for navigator.userAgent), implement feature detection instead:

http://www.jibbering.com/faq/faq_notes/not_browser_detect.html


PointedEars
 
G

Gordon

Gordon said the following on 11/16/2007 12:12 PM:


Not that I have ever been able to find in IE. If you are going to add a
button to the page, why not just put a note on the page telling how to
invoke the find dialog box? F3 key does the same thing as Ctrl-F does.

Because the boss wants a button to click that will open find. I'm
just the code monkey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,685
Members
48,796
Latest member
Greg L.

Latest Threads

Top