Enable jump to match and highlight within document

Top  Previous  Next

You can setup highlighting to occur on the actual page of your website when you click on a search result. However, this requires you to add some Javascript to each page of your site where you want this feature to take effect. It will highlight the word that the user was looking for in the search engine, as well as scroll the window down to the first appearance of the word.

lightbulb

Note: This feature only works for HTML web pages, and does not work for Word, PDF, XLS and other document types. It also will not work for Javascript disabled browsers. For PDF documents, you can enable a similar behaviour within Acrobat Reader via the "Highlight and locate" option in the PDF plugin settings. See "Configuring a plugin" for more information.

First, you must enable this option in the Configuration window (under the “Results Layout” tab).

Once you have enabled this option and re-indexed your website, you must locate the "highlight.js" file included with Zoom. This file can be found in the "extras" folder, which you can access from Zoom Indexer, by clicking on "Tools" in the menu and selecting the option to "Open 'Extras' folder" (also see "Where is the Program Data directory?").

screenshot_tools_extras

Copy the "highlight.js" file from the "extras" folder to your website files, as you will need to link to the "highlight.js" file from each page of your site that requires the feature.

For example, you could paste the following HTML in your site’s header or footer:

<style type="text/css">.highlight { background: #FFFF40; }</style>

<script type="text/javascript" src="highlight.js"></script>

 

Note that you will need to specify the correct path to “highlight.js” depending on where the file is located relative to the page. You will then need to modify the BODY tag on your page to include an "onLoad" attribute, such as:

<body onload="highlight();">

 

If for some reason you can not modify the body tag of your page, an alternative would be to put the following line after the </body> tag of your page:

<script type="text/javascript">highlight();</script>
Once you have successfully applied the above changes, you should find that clicking on a search result will go straight to the word found and all matching words will be highlighted.