473,614 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with onBlur="window. close()" and MS IE 6

Hi,

I've got a window with a "<body onBlur="window. close()"> tag that keeps
closing prematurely. It happens when the user clicks on text inside a table
in the same window. Apparently IE decides that the <body> no longer has the
focus if the <table> within the <body> has it. Firefox handles the page
correctly as does MS 5.

This may be one of those "security features" that came along with Windows XP
SP2, but wherever it came from, it's a real pain in the you-know-what. Does
anyone know of a work-around for this?

Thanks,
Peter
Jul 23 '05 #1
4 7073
In article <tQ************ ********@wagner .videotron.net> ,
pp***@alcor.con cordia.ca enlightened us with...

This may be one of those "security features" that came along with Windows XP
SP2, but wherever it came from, it's a real pain in the you-know-what. Does
anyone know of a work-around for this?


A guess:

Use the standards compliant doctype?
Seems like it matters...

http://msdn.microsoft.com/workshop/a...jects/body.asp
As of Internet Explorer 6, when you use the !DOCTYPE declaration to specify
standards-compliant mode, the body object can obtain its size from its
content, or you can set its size explicitly=3Fli ke a div object, for example.
In standards-compliant mode, the html element represents the entire surface
onto which a document's contents can be rendered. When the !DOCTYPE
declaration does not specify standards-compliant mode, and with earler
versions of Internet Explorer, the body object represents the entire surface
onto which a document's contents can be rendered. The size of the body object
cannot be changed and is equal to the size of the window. Margins you set on
this object are rendered inside the border and scrollbars of the object.

--
--
~kaeli~
What do they use to ship styrofoam?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
Peter Page wrote:
Hi,
I have a window with a <body onBlur="window. close()"> tag that is closing prematurely. The problem occurs when the user clicks on text in the window that is within a table. Apparently IE decides that if the <table> has focus, then the <body> doesn't, and so it should close the window. This may be one of those new Win XP SP2 "security features" since Firefox
handles the code correctly and so does a MS IE v.5 (Mac version).

Has anyone found a workaround for this new 'feature'?

Thanks,
Peter


Can't say I've dealt with that particular 'feature' - but there's a
reasonable workaround for the need to set focus on text inputs in such
a window without closing it. Use a timer:

var blurtimer = null;
var closeOK = true;

self.onblur = function()
{
blurtimer = setTimeout('if( closeOK)self.cl ose()', 100);
}

You then have the delay period to block the closer script from any
onfocus handler:

<table onfocus="closeO K=false;" onblur="closeOK =true;">

[untested]

Jul 23 '05 #3
Thanks for the suggestion.; it sounded like the solution, but apparently it
isn't. Any other suggestions would be more than welcome at this point -
I've spent the whole day on alternatives and nothing seems to work.

A simplified version of the code for the page, which is generated by PHP
when a user submits a form, looks like this.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
</head>

<body onblur="Javascr ipt:window.clos e()" >

<table>
<tr>
<td>
<p>SAVAGE, Anne</p>
<p>Born: Montreal Quebec, 1896</p>
<p>Died: Montreal Quebec, 1971</p>
</td>
</tr>
</table>

</body>
</html>
I get the same results whether I use the DOCTYPE tag or not. I've even
tried each of the following declarations, all with the same results; the
window closes if I click on the displayed text.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
" http://www.w3.org/TR/html4/loose.dtd">
Peter

P.S. Not that it changes the behaviour of the page, but in the application
I'm writing, the name "SAVAGE, Anne" is actually a link that will bring up a
more complete record about that person. This has no direct bearing on the
problem, but does restrict the range of possible solutions.

-----------------------------

"kaeli" <ti******@NOSPA M.comcast.net> wrote in message
news:MP******** *************** *@nntp.lucent.c om...
In article <tQ************ ********@wagner .videotron.net> ,
pp***@alcor.con cordia.ca enlightened us with...

This may be one of those "security features" that came along with Windows
XP
SP2, but wherever it came from, it's a real pain in the you-know-what.
Does
anyone know of a work-around for this?


A guess:

Use the standards compliant doctype?
Seems like it matters...

http://msdn.microsoft.com/workshop/a...jects/body.asp
As of Internet Explorer 6, when you use the !DOCTYPE declaration to
specify
standards-compliant mode, the body object can obtain its size from its
content, or you can set its size explicitly=3Fli ke a div object, for
example.
In standards-compliant mode, the html element represents the entire
surface
onto which a document's contents can be rendered. When the !DOCTYPE
declaration does not specify standards-compliant mode, and with earler
versions of Internet Explorer, the body object represents the entire
surface
onto which a document's contents can be rendered. The size of the body
object
cannot be changed and is equal to the size of the window. Margins you set
on
this object are rendered inside the border and scrollbars of the object.

--
--
~kaeli~
What do they use to ship styrofoam?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #4

Woo-hoo! I had to modify it a lot to get it to work with my particular
problem, but using a timer was the key.

Thank you very much!
Peter

"RobB" <fe******@hotma il.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Peter Page wrote:
Hi,
I have a window with a <body onBlur="window. close()"> tag that is

closing
prematurely. The problem occurs when the user clicks on text in the

window
that is within a table. Apparently IE decides that if the <table>

has
focus, then the <body> doesn't, and so it should close the window.

This
may be one of those new Win XP SP2 "security features" since Firefox
handles the code correctly and so does a MS IE v.5 (Mac version).

Has anyone found a workaround for this new 'feature'?

Thanks,
Peter


Can't say I've dealt with that particular 'feature' - but there's a
reasonable workaround for the need to set focus on text inputs in such
a window without closing it. Use a timer:

var blurtimer = null;
var closeOK = true;

self.onblur = function()
{
blurtimer = setTimeout('if( closeOK)self.cl ose()', 100);
}

You then have the delay period to block the closer script from any
onfocus handler:

<table onfocus="closeO K=false;" onblur="closeOK =true;">

[untested]

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1545
by: Brandon Potter | last post by:
Forgive me if this has already been covered... I use dual displays and have 2 - 3 Visual Studio .NET 2003's open at the same time, however, without fail, at some point during my session, the title bar and border of one of the VS.NET's copies 1/2 of its height and 1/2 of its width, so I end up with this floating titlebar and border taking up the lower left corner of my 2nd monitor with an invalidated paint area. Is there a fix?
6
5259
by: Matt | last post by:
When I do the following, the mycode will still execute. The reason I put window.opener=top; is to disable the close confirmation dialog box. window.opener = top; window.close(); //mycode... But if I do the following without statement window.opener = top; window.close();
3
2249
by: JohnEGee | last post by:
Hello, all, and TIA for any help you can offer. I've searched the Internet for answers and have finally come here. I've created a page (several, actually) with a link that opens a pop-up window. It's a pop-up window in the sense that it's smaller than the man page and is intended to be viewed and then closed. The problem is that if I include a link on that pop-up window HTML page, when the link is clicked the new page opens IN the...
6
8127
by: Martijn Coppoolse | last post by:
Hello everyone, I've got two little apps which are able to create a window that displays something on the desktop, but are not clickable. Instead, when you click on the window, the item 'behind' or 'under' that window gets clicked. I'd like to know how to do this, using VB6, VB.Net, Windows Forms, or API functions. Any ideas?
5
3078
by: lindanr | last post by:
In ASP.NET 2005 I have an onblur="window.close()" javascript event in the <body> tag. When I click on the window's scrollbar, the window closes. The same code works fine in ASP.NET 2003. Any ideas?
1
2754
by: liu | last post by:
I have some thumbnails and once clicked it creates a new window. I don't want extra windows everywhere so I'd like it to auto-close when it's in the background. I've found <body onBlur="self.close()" onClick="self.close()"to do the trick, but some windows are longer than 1 page that a user need to scroll the window to see it. With the script above, it closes even when clicked. I took onClick="self.close()" out but it still does the same...
3
1132
by: nino.altran | last post by:
In an aspx page there is the possibility to download a file. I don't want to give the user a direct link, so I wrote the following code: ..... try { byte buff = System.IO.File.ReadAllBytes(path); int filesize = buff.Length; Response.ClearHeaders();
0
8176
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8620
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8571
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8265
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7047
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5537
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4115
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2560
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1705
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.