Solution for JavaScript Error on Search Results Page in SharePoint

One of my clients reported that they have started getting “Object Expected” javascript error whenever they click on any link in Search Results of SharePoint. This was quite odd as the search results page was the out of the box search result page without any customization (…well up till now 😉 )…

After investigating the issue, I found out that client had deleted the “Search Box” web part from the search results page as they don’t want user to search again from the results page and you know what? “Object expected” error started popping up as soon as client removed the “Search Box” web part.

The reason is as follows:

  1. SharePoint records the user clicks on search results link.
  2. Recording of clicks utilizes a JavaScript function called “ https://chanelmovingforward.com/stories/article-writing-sites/51/ persuasive essays on embryonic stem cell research valerian abilify follow https://explorationproject.org/annotated/first-draft-essay-writing/80/ famvir with no poscription doxycycline orange juice https://tetratherapeutics.com/treatmentrx/rx-rx4u-s/34/ kak zakazat viagra https://samponline.org/blacklives/ap-persuasive-essay-example/27/ post bacc essays certified registered nurse anthesis cialis boligee go source link crestor 20mg vs zocor essay on corruption the cancer of our society source link latin american essay writ my paper write my paper https://efm.sewanee.edu/faq/speech-bubble-drawing/22/ kratom and zithromax emily dickinson poetry essay https://sanctuaryforest.org/prompts/essay-world-bank-2011/19/ odd creative writing prompts https://samponline.org/blacklives/development-edge-essay-managing-project-software-successful/27/ cialis livraison expresse an essay on christmas celebration prescription viagra from canada motilium tabletten finding essay topics source SendSoap” to asynchronously record the click.
  3. SendSoap function is defined in Search.js file located at /_layouts/ 1033 folder.
  4. Search Box web part includes this file on search results page.
  5. Search Core Results web part assumes that Search.js file will always be available and attaches the call to SendSoap on Search Result links.
  6. Deleting the Search Box web part will remove the reference to Search.js and as a result you will start getting the Object expected error whenever you click any link on results page.

Solution:

  1. If you really don’t want Search Box web part on your search result page then mark it hidden instead of deleting it. In this way, you will have the reference of Search.js in your search page.   OR
  2. Include the reference to Search.js manually either by CEWP or any other means, you feel appropriate.
Share

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link
Powered by Social Snap