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:
- SharePoint records the user clicks on search results link.
- Recording of clicks utilizes a JavaScript function called “ https://academicminute.org/paraphrasing/thesis-statement-on-alcoholism/3/ writing services in less than 8 hours https://www.cei.utah.edu/wp-content/blogs.dir/15/files/2013/?speech=working-long-hours-essay https://www.lapressclub.org/hypothesis/dissertation-proofreading-costs/29/ cialis 6 minute pill write on paper online buy suhagra online https://bigsurlandtrust.org/care/18004900365/20/ propecia in canada viagra gel preis flagyl cream ukulele viagra mg minirin spray fiyati viagra do your homework vine batman write phd thesis in a month http://visablepeople.com/sample-essay-about-education-10788/ clomid 625 mg acetaminophen essay war short essay travelling https://carlgans.org/report/free-dissertation-topics-in-marketing/7/ see url follow covering letter example for job application http://go.culinaryinstitute.edu/how-to-know-my-ip-address-is-hacked/ proofreading help online https://www.aestheticscienceinstitute.edu/medical/crestor-rhabdomyolysis-rate/100/ homework help oklahoma cialis tabletten 10 mg https://www.mitforumcambridge.org/multiple/application-for-college/2/ click here home design and drafting services nombre comercial de cialis en argentina SendSoap” to asynchronously record the click.
- SendSoap function is defined in Search.js file located at /_layouts/ 1033 folder.
- Search Box web part includes this file on search results page.
- Search Core Results web part assumes that Search.js file will always be available and attaches the call to SendSoap on Search Result links.
- 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:
- 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
- Include the reference to Search.js manually either by CEWP or any other means, you feel appropriate.