Pages

Tuesday, March 18, 2014

Google Custom Search and Firefox

Another thing I`ve worked on was an implementing of the google custom search for our website. We`ve decided to use two paged view. The script for search input was stored into a user control whichwas used on every page and the script for results was added to a separate page.

Clean and easy! Almost... This worked just fine for most of the browsers - Chrome (obviously), Opera, Safari... But the Firefox was an unpleasant exception. It was throwing google.search.Search.apiaryXXXXX is not a function, like:

TypeError: google.search.Search.apiary17868 is not a function

So this task will require something bigger then a copy-paste :)
And the answer was to implement our own control for search input, because the exception comes from 2 google scripts on a single page..  Moreover - implementing input string as a separate control will result in more flexible design!

The simplest implementation in WebForms - 1 TextBox, 1 Button and a handler for that button with redirect:

Response.Redirect(_searchResultsUrl + "?" + QuerystringParam + txt.Text);



No comments:

Post a Comment