...

View Full Version : Random problem reading status bar with both IE6 and IE7



fischermx
02-23-2007, 03:58 PM
I have a JS that under certain event (on focus) reads the status bar from IE6 and IE7 and performs certain action.
It works on most of the cases, but in the log of this application, I see like 30% of the cases, the status bar returns blank.

In my tests, both IE6 and IE7 works perfectly fine, in my development computer. But in production, with people coming from all over the world with who knows what funny software installed in their machine, it some times fails.

When it fails, it mostly fails for all the user's section, but I've seen some cases when for the same user, sometimes it works and sometimes it doesn't.

I'm thinking that may be a plugin installed in the user's browser might be interfering but I'm not sure.

Please, any idea is very welcome.

MikeFoster
02-23-2007, 05:33 PM
Hi fischermx, Welcome to Coding Forums!

IE7 has a user-option to allow or not allow scripts to update the status bar. You can't depend on having access to the status bar.

Here is an alternative idea. Any code that writes to the status bar should call the following function instead.


var gStatus = '';
function setStatus(s)
{
gStatus = s;
window.status = s;
}

Now when you need to read the status bar read gStatus instead.

Just a quick idea ;)

fischermx
02-23-2007, 05:55 PM
Thanks. That's almost what I'm doing.
But I don't need to write the status bar, I don't do it.
I just read it.

MikeFoster
02-23-2007, 05:58 PM
Then what are you trying to get from the status bar? Perhaps there's another way to get what you need.

fischermx
02-23-2007, 07:38 PM
My code goes like this:

I get all iframe elements:
elements = document.getElementsByTagName("iframe");

Then I iterate on them checking:
if(elements[i].src.indexOf('googlesyndication.com') > -1)

Then I assign an event to the onfocus:
elements[i].onfocus = myfunc;

And "myfunc" is:

function myfunc(e, o)
{
statusbar = window.status;
var img3 = new Image();
img3.src = "htpp://blahblah?adtext=statusbar"
}

MikeFoster
02-23-2007, 08:41 PM
Nope. I'm out of ideas, sorry.

glenngv
02-23-2007, 09:52 PM
onfocus fires when an element has no focus. Once focused, onfocus no longer fires. You have to blur on the element and re-focus to trigger onfocus again. Maybe that's why your code works inconsistently.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum