Use Browser Search (Ctrl+F) through a button in website?
I have created a website and have added a button and lot of text. What I want is to use the browser search (Ctrl+F), when I press the button which I added in website.
How can I achieve this?
Solution 1:
It kind of works for FF. See this page
<a href="#" onclick="find();">Find in This Page...</a>
Solution 2:
update: from mark's comment:
From my testing
window.find()
is supported in Chrome 37, and FF31, but not IE11
update:
for more information on this window.find go here
Solution 3:
No. In general, you cannot invoke browser controls from inside the webpage - security, sandboxing, and all that.
You need to make some sort of in-page search - if you're using a CMS, most of them have a simple search feature built-in.
If you want to do this in JavaScript, there are various scripts that emulate this in-page; randomly selected from my query "javascript find in page" is this one: http://www.seabreezecomputers.com/tips/find.htm