Skip to content Skip to sidebar Skip to footer

How Do I Disable Body.blur() In IE8?

I work on an enterprise web application that runs in IE8. It appears blur() is being called on the body causing the IE window to be sent to the background. Unfortunately this code

Solution 1:

You should be able to hard code blur to a dummy method. If you can get in before it is called, just call body.blur = function() {}; (assuming body is pointing to your DOM body element).


Solution 2:

Using jQuery you could simply block the event :

$('body').blur(function(e) { e.preventDefault(); });

Solution 3:

If using Firefox is an option, i have two answers where i propose replacing the function using Greasemonkey.

  1. Using javascript to create a keylistener hotkey for facebook page "like"
  2. Greasemonkey script to replace jQuery plugin function?

If you have to use IE, you might need to change the page itself.
(I know there is Trixie and IE7pro for IE, but never used).


Solution 4:

I had an issue when using javaScript editor:CLEditor, if I use jQuery blur() method on it, the IE window goes to the background. CLEditor has it's iframe which has its own body. When you extract that body and use body.blur(), IE browser will go to the background.

Other browsers are not showing that behavior, so it is better to use FF, or Chrome if you are experiencing this.

If you remove body.blur(), probably you would have less problems with IE than you have now, but still you could experience some minor bugs (something is not loosing focus at certain point), but I suppose you could live with it. However if blur() event is enriched with some logic, it could be problem - then find its definition and move logic to some other event that is started with the browser (onload, or ready).


Solution 5:

document.body.blur=function(){document.body.focus()}

Post a Comment for "How Do I Disable Body.blur() In IE8?"