Troubleshooting the Jump to highlighting script

This support article is written in reference to the optional Jump to highlighting Javascript.

This article applies to the operation of the Jump to highlighting script on HTML pages. On most HTML pages this script will work without problem. But we are aware that there is some potential conflict if multiple scripts from different developers are included on to the same HTML page.

Due to the nature of the Javascript platform, we cannot guarantee that the jump to highlighting script (highlight.js) will work harmoniously with the other Javascripts you have on your website. Every script works differently and each one has different dependencies. The highlight script re-writes the HTML on the page to include additional HTML tags. This results in the keywords on the page being highlighted.

If your web pages rely on the use of other Javascripts and you wish to implement the jump to highlighting feature, you should be prepared to do some debugging work of your own, in case problems occur and there is a functional conflict between scripts.

But having said that, here are some tips on getting the scripts to play together, should you find other Javascripts on your page stopping the highlighting script from working, or vice versa.

The majority of conflicts can be resolved by simply adjusting the execution order of the scripts. First of all, if your other scripts are being called from the body onload tag, as below, you should add the the call to "highlight();" before the call to the other script.

<body onload="highlight(); P7_initPM(0,14,1,-10,10);">

In the above example, the jump to highlighting script is being called before the excellent ProjectSeven Pop Menu Magic script. This allows both scripts to work as intended.

If you have more than one script to call on the same page, then always call the jump to highlighting script first, before calling the other scripts.

<body onload="highlight(); P7_initPM(0,14,1,-10,10); tt_Init();">

Sometimes a script may not be designed to allow you to alter or specify the order in which it should execute. For example, the "wz_tooltip.js" tooltip script from walterzorn.com is executed as soon as the file is linked to the page. In this case, you will need to alter the script accordingly so that it does not do this. For the tooltip script, this involves simply commenting out one line (by adding "//" in front of the line) at the very bottom of "wz_tooltip.js":

//tt_Init();

You will then need to add this function call to the onload property, after calling "highlight();", as demonstrated earlier.

An alternative to the above method of calling "highlight()" in the onload attribute, would be to call the highlight function after the </body> tag on the page, as follows:

... rest of page here. This is the bottom of the webpage.
</body>
<script type="text/javascript">highlight();</script>
</html>

This method can also work in many cases.

Other similar menu systems that would work fine with the jump to highlighting script would be ones which do not use Javascript and rely entirely on CSS such as the free GRC Pure-CSS Menuing System.

We hope that the above tips are of help in locating and resolving your script conflicting issues.

List of tested third party scripts

The following is a brief list of third party scripts which have been tested to work with our jump to highlighting script without issue (either by default or by implementing one of the methods described above).

Known limitations

Please note that highlighting functionality is limited and it does not ensure that all keywords used to retrieve the search result will be highlighted. For example, if a search word matched because of a synonym, or use of the "accent insensitivity" feature, or stemming, then the keyword may not necessarily be highlighted, despite it being considered a matching search result.

There are known issues with highlighting and jumping to words containing some foreign characters such as those exclusive to the windows-1250 and windows-1251 charset, and similar. For some languages, this only affects a subset of the accent and diacritic characters (such as those in the Croatian language). It can work well in some other languages for these same charsets. UTF-8, however, provides best compatibility with the highlighting script for non-English languages.

Another limitation of this feature is that it will fail to highlight text separated by HTML tags. This can also cause some exact phrases to be not highlighted if some words in the phrase are separated by a tag. Note that this limitation only exists in regards to highlighting on the actual page. Highlighting on the search results page (and the context descriptions) works fine regardless of the tags, because this uses the actual index data.

On some web pages, an unclosed HTML tag (such as a <p> tag without a matching </p> tag) may cause the highlighting script to trigger a bug in the Internet Explorer 6.0 browser. This bug causes a strange behaviour in IE, where the page will load and display successfully, but an additional error would appear with the message: "Internet Explorer cannot open the Internet site ... Operation aborted". We've found that closing the tag will often solve the problem. We've also found that the problem could sometimes be avoided by using the first method (described in the above instructions) with calling the "highlight();" function using the body onload attribute, as opposed to the latter alternative.

Return to the Zoom Search Engine Support page.