try {if(null != event) event.returnValue = false;} catch (err) {}
Internet Explorer, Opera, and Webkit-based browsers (Safari, Chrome, etc.) support the global event
object, but Firefox does not. Thus, the try object supresses the error and nothing happens.
To fix it, we can write our own event handler for any search box. A nice bonus is that this can be adapted to work with any search page, including custom ones built on web parts.
First, add this Javascript to your masterpage HEAD, a Javascript include file, or a Content Editor Web Part. There are two variables you’ll need to change:
searchUrl
– The location of your search page.searchBoxId
– The ID of your search textbox.
functionsearchKeyDown(event) {
var searchUrl = '/Pages/Search.aspx';
var searchBoxId = 'searchElement';
if(window.event)
event = window.event;
varkc = event.which ? event.which : event.keyCode;
if (kc == 13)
setTimeout(“location.href = ‘” + searchUrl + “?k=’ + escape(document.getElementById(‘” + searchBoxId + “‘).value)”, 15);
}
Second, find your search box’s definition and add the following onkeydown attribute:
onkeydown
="searchKeyDown(event)"
Hitting enter should now complete your searches in all browsers.
Hi we found that the Issue went away when we added the site address minus the www. to the sites – Compatibility view settings in IE 11 Settings. All good from there on in.
Thanks you!!! This was very helpful.