IE8: What's wrong with document.documentElement.clientWidth?

  • Thread starter Thread starter Axel Dahmen
  • Start date Start date
A

Axel Dahmen

Guest
I've created a JavaScript checking for browser properties on load.



From David Flanagan's book "JavaScript: The Definitive Guide", 5th edition,

published by O'Reilly, page 276, I learned that IE6+ may be recognized from

an expression like the following:



if (document.documentElement && document.documentElement.clientWidth) {...}



But this expression sometimes yields false!



I don't know yet what exactly causes the "false" condition, but it always

happens when I start-up my machine and double-click a
 
I've just made a test:



Apparently, at first start-up after machine boot,

document.documentElement.clientWidth==0.



Seems dangerous to me to use this property then...









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

"Axel Dahmen" schrieb im Newsbeitrag

news:4779441E-F33B-4212-A393-45F9F5820EF6@microsoft.com...

> I've created a JavaScript checking for browser properties on load.

>

> From David Flanagan's book "JavaScript: The Definitive Guide", 5th

> edition, published by O'Reilly, page 276, I learned that IE6+ may be

> recognized from an expression like the following:

>

> if (document.documentElement && document.documentElement.clientWidth)

> {...}

>

> But this expression sometimes yields false!

>

> I don't know yet what exactly causes the "false" condition, but it always

> happens when I start-up my machine and double-click a page linking to the above JavaScript. Once reloaded this condition always

> yields "true".

>

> Anyone experienced this behaviour before? What would be a better

> conditional expression than the one above? Explicitly checking for

> undefined? Or null?

>

> TIA,

> Axel Dahmen

> www.axeldahmen.de
 
Developer-specific resources include:



MSDN IE Development Forum (post such questions here instead)

http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/threads



IE Developer Center

http://msdn.microsoft.com/en-us/ie/default.aspx



Learn IE8

http://msdn.microsoft.com/en-us/ie/aa740473.aspx



HTML and DHTML Overviews and Tutorials

http://msdn.microsoft.com/en-us/library/ms537623.aspx and



Cascading Style Sheets (CSS)

http://msdn2.microsoft.com/en-us/ie/aa740476.aspx



Expression Web SuperPreview for Internet Explorer (free, stand-alone visual

debugging tool for IE6, IE7, and IE8)

http://www.microsoft.com/downloads/...FamilyID=8e6ac106-525d-45d0-84db-dccff3fae677



Expression Web SuperPreview Release Notes

http://www.microsoft.com/expression/products/Web_SuperPreviewReleaseNotes.aspx



Validators:

http://validator.w3.org/

http://jigsaw.w3.org/css-validator/



--

~Robear Dyer (PA Bear)

MS MVP-IE, Mail, Security, Windows Client - since 2002



Axel Dahmen wrote:

> I've just made a test:

>

> Apparently, at first start-up after machine boot,

> document.documentElement.clientWidth==0.

>

> Seems dangerous to me to use this property then...

>

>

>

>

> ---------------------------

> "Axel Dahmen" schrieb im Newsbeitrag

> news:4779441E-F33B-4212-A393-45F9F5820EF6@microsoft.com...

>> I've created a JavaScript checking for browser properties on load.

>>

>> From David Flanagan's book "JavaScript: The Definitive Guide", 5th

>> edition, published by O'Reilly, page 276, I learned that IE6+ may be

>> recognized from an expression like the following:

>>

>> if (document.documentElement && document.documentElement.clientWidth)

>> {...}

>>

>> But this expression sometimes yields false!

>>

>> I don't know yet what exactly causes the "false" condition, but it always

>> happens when I start-up my machine and double-click a > page linking to the above JavaScript. Once reloaded this condition always

>> yields "true".

>>

>> Anyone experienced this behaviour before? What would be a better

>> conditional expression than the one above? Explicitly checking for

>> undefined? Or null?

>>

>> TIA,

>> Axel Dahmen

>> www.axeldahmen.de
 
Did you miss to send any personal response in addition to your signature?



Or haven't you read my complaint about something not working in IE8 although

should? My posting has actually been a bug report...



Thanks,

Axel Dahmen





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

"PA Bear [MS MVP]" schrieb im Newsbeitrag

news:#0$MXTWuKHA.1852@TK2MSFTNGP05.phx.gbl...

> Developer-specific resources include:

>

> MSDN IE Development Forum (post such questions here instead)

> http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/threads

>

> IE Developer Center

> http://msdn.microsoft.com/en-us/ie/default.aspx

>

> Learn IE8

> http://msdn.microsoft.com/en-us/ie/aa740473.aspx

>

> HTML and DHTML Overviews and Tutorials

> http://msdn.microsoft.com/en-us/library/ms537623.aspx and

>

> Cascading Style Sheets (CSS)

> http://msdn2.microsoft.com/en-us/ie/aa740476.aspx

>

> Expression Web SuperPreview for Internet Explorer (free, stand-alone

> visual debugging tool for IE6, IE7, and IE8)

> http://www.microsoft.com/downloads/...FamilyID=8e6ac106-525d-45d0-84db-dccff3fae677

>

> Expression Web SuperPreview Release Notes

> http://www.microsoft.com/expression/products/Web_SuperPreviewReleaseNotes..aspx

>

> Validators:

> http://validator.w3.org/

> http://jigsaw.w3.org/css-validator/

>

> --

> ~Robear Dyer (PA Bear)

> MS MVP-IE, Mail, Security, Windows Client - since 2002

>

> Axel Dahmen wrote:

>> I've just made a test:

>>

>> Apparently, at first start-up after machine boot,

>> document.documentElement.clientWidth==0.

>>

>> Seems dangerous to me to use this property then...

>>

>>

>>

>>

>> ---------------------------

>> "Axel Dahmen" schrieb im Newsbeitrag

>> news:4779441E-F33B-4212-A393-45F9F5820EF6@microsoft.com...

>>> I've created a JavaScript checking for browser properties on load.

>>>

>>> From David Flanagan's book "JavaScript: The Definitive Guide", 5th

>>> edition, published by O'Reilly, page 276, I learned that IE6+ may be

>>> recognized from an expression like the following:

>>>

>>> if (document.documentElement && document.documentElement.clientWidth)

>>> {...}

>>>

>>> But this expression sometimes yields false!

>>>

>>> I don't know yet what exactly causes the "false" condition, but it

>>> always

>>> happens when I start-up my machine and double-click a >> page linking to the above JavaScript. Once reloaded this condition

>>> always

>>> yields "true".

>>>

>>> Anyone experienced this behaviour before? What would be a better

>>> conditional expression than the one above? Explicitly checking for

>>> undefined? Or null?

>>>

>>> TIA,

>>> Axel Dahmen

>>> www.axeldahmen.de


>
 
PA Bear sent you a list of links to various IE developer resources.



This is just a newsgroup for users of IE to discuss things with other users,

not a bug reporting facility. MS dev don't monitor this group. Bugs should

normally be posted through the Microsoft Connect site at

http://connect.microsoft.com , although you'll find that the IE reporting

system was disabled when the beta ended. If you go to

https://connect.microsoft.com/IE then you'll see that under Other Feedback

Channels there is the IE Developer Forum - this is the first link that PA

Bear included in his reply, and is the only feedback resource listed by MS

for IE8.



Dan





"Axel Dahmen" wrote in message

news:8010F3BB-9E7B-40BA-A804-3D40E07B0C86@microsoft.com...

> Did you miss to send any personal response in addition to your signature?

>

> Or haven't you read my complaint about something not working in IE8

> although should? My posting has actually been a bug report...

>

> Thanks,

> Axel Dahmen

>

>

> --------------

> "PA Bear [MS MVP]" schrieb im Newsbeitrag

> news:#0$MXTWuKHA.1852@TK2MSFTNGP05.phx.gbl...

>> Developer-specific resources include:

>>

>> MSDN IE Development Forum (post such questions here instead)

>> http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/threads

>>

>> IE Developer Center

>> http://msdn.microsoft.com/en-us/ie/default.aspx

>>

>> Learn IE8

>> http://msdn.microsoft.com/en-us/ie/aa740473.aspx

>>

>> HTML and DHTML Overviews and Tutorials

>> http://msdn.microsoft.com/en-us/library/ms537623.aspx and

>>

>> Cascading Style Sheets (CSS)

>> http://msdn2.microsoft.com/en-us/ie/aa740476.aspx

>>

>> Expression Web SuperPreview for Internet Explorer (free, stand-alone

>> visual debugging tool for IE6, IE7, and IE8)

>> http://www.microsoft.com/downloads/...FamilyID=8e6ac106-525d-45d0-84db-dccff3fae677

>>

>> Expression Web SuperPreview Release Notes

>> http://www.microsoft.com/expression/products/Web_SuperPreviewReleaseNotes.aspx

>>

>> Validators:

>> http://validator.w3.org/

>> http://jigsaw.w3.org/css-validator/

>>

>> --

>> ~Robear Dyer (PA Bear)

>> MS MVP-IE, Mail, Security, Windows Client - since 2002

>>

>> Axel Dahmen wrote:

>>> I've just made a test:

>>>

>>> Apparently, at first start-up after machine boot,

>>> document.documentElement.clientWidth==0.

>>>

>>> Seems dangerous to me to use this property then...

>>>

>>>

>>>

>>>

>>> ---------------------------

>>> "Axel Dahmen" schrieb im Newsbeitrag

>>> news:4779441E-F33B-4212-A393-45F9F5820EF6@microsoft.com...

>>>> I've created a JavaScript checking for browser properties on load.

>>>>

>>>> From David Flanagan's book "JavaScript: The Definitive Guide", 5th

>>>> edition, published by O'Reilly, page 276, I learned that IE6+ may be

>>>> recognized from an expression like the following:

>>>>

>>>> if (document.documentElement && document.documentElement.clientWidth)

>>>> {...}

>>>>

>>>> But this expression sometimes yields false!

>>>>

>>>> I don't know yet what exactly causes the "false" condition, but it

>>>> always

>>>> happens when I start-up my machine and double-click a >>> HTML

>>>> page linking to the above JavaScript. Once reloaded this condition

>>>> always

>>>> yields "true".

>>>>

>>>> Anyone experienced this behaviour before? What would be a better

>>>> conditional expression than the one above? Explicitly checking for

>>>> undefined? Or null?

>>>>

>>>> TIA,

>>>> Axel Dahmen

>>>> www.axeldahmen.de


>>
 
Hi, Dan,



thanks for replying.



I followed a Hyperlink from the Microsoft site telling differently:





http://www.microsoft.com/windows/internet-explorer/support/call-us.aspx



"Other support options

Leave feedback

If you have any feedback about Internet Explorer 8, please post it to

our newsgroup. "





For me this seemed the only way to get in touch with the IE development

team. The IE8 Connect channel has been closed down and there is no new IE9

Channel available at this time.



I'll try to follow the forum link, however, now. I had the impression so far

this forum was for plug-in developers only.



Thanks, Dan & PA for enlightening me!



Yours,

Axel Dahmen









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

"Dan" schrieb im Newsbeitrag

news:ACCF93C7-9204-4D69-B03E-4AF424403169@microsoft.com...

> PA Bear sent you a list of links to various IE developer resources.

>

> This is just a newsgroup for users of IE to discuss things with other

> users, not a bug reporting facility. MS dev don't monitor this group. Bugs

> should normally be posted through the Microsoft Connect site at

> http://connect.microsoft.com , although you'll find that the IE reporting

> system was disabled when the beta ended. If you go to

> https://connect.microsoft.com/IE then you'll see that under Other

> Feedback Channels there is the IE Developer Forum - this is the first link

> that PA Bear included in his reply, and is the only feedback resource

> listed by MS for IE8.

>

> Dan

>

>

> "Axel Dahmen" wrote in message

> news:8010F3BB-9E7B-40BA-A804-3D40E07B0C86@microsoft.com...

>> Did you miss to send any personal response in addition to your signature?

>>

>> Or haven't you read my complaint about something not working in IE8

>> although should? My posting has actually been a bug report...

>>

>> Thanks,

>> Axel Dahmen

>>

>>

>> --------------

>> "PA Bear [MS MVP]" schrieb im Newsbeitrag

>> news:#0$MXTWuKHA.1852@TK2MSFTNGP05.phx.gbl...

>>> Developer-specific resources include:

>>>

>>> MSDN IE Development Forum (post such questions here instead)

>>> http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/threads

>>>

>>> IE Developer Center

>>> http://msdn.microsoft.com/en-us/ie/default.aspx

>>>

>>> Learn IE8

>>> http://msdn.microsoft.com/en-us/ie/aa740473.aspx

>>>

>>> HTML and DHTML Overviews and Tutorials

>>> http://msdn.microsoft.com/en-us/library/ms537623.aspx and

>>>

>>> Cascading Style Sheets (CSS)

>>> http://msdn2.microsoft.com/en-us/ie/aa740476.aspx

>>>

>>> Expression Web SuperPreview for Internet Explorer (free, stand-alone

>>> visual debugging tool for IE6, IE7, and IE8)

>>> http://www.microsoft.com/downloads/...FamilyID=8e6ac106-525d-45d0-84db-dccff3fae677

>>>

>>> Expression Web SuperPreview Release Notes

>>> http://www.microsoft.com/expression/products/Web_SuperPreviewReleaseNotes..aspx

>>>

>>> Validators:

>>> http://validator.w3.org/

>>> http://jigsaw.w3.org/css-validator/

>>>

>>> --

>>> ~Robear Dyer (PA Bear)

>>> MS MVP-IE, Mail, Security, Windows Client - since 2002

>>>

>>> Axel Dahmen wrote:

>>>> I've just made a test:

>>>>

>>>> Apparently, at first start-up after machine boot,

>>>> document.documentElement.clientWidth==0.

>>>>

>>>> Seems dangerous to me to use this property then...

>>>>

>>>>

>>>>

>>>>

>>>> ---------------------------

>>>> "Axel Dahmen" schrieb im Newsbeitrag

>>>> news:4779441E-F33B-4212-A393-45F9F5820EF6@microsoft.com...

>>>>> I've created a JavaScript checking for browser properties on load.

>>>>>

>>>>> From David Flanagan's book "JavaScript: The Definitive Guide", 5th

>>>>> edition, published by O'Reilly, page 276, I learned that IE6+ may be

>>>>> recognized from an expression like the following:

>>>>>

>>>>> if (document.documentElement && document.documentElement.clientWidth)

>>>>> {...}

>>>>>

>>>>> But this expression sometimes yields false!

>>>>>

>>>>> I don't know yet what exactly causes the "false" condition, but it

>>>>> always

>>>>> happens when I start-up my machine and double-click a >>>> HTML

>>>>> page linking to the above JavaScript. Once reloaded this condition

>>>>> always

>>>>> yields "true".

>>>>>

>>>>> Anyone experienced this behaviour before? What would be a better

>>>>> conditional expression than the one above? Explicitly checking for

>>>>> undefined? Or null?

>>>>>

>>>>> TIA,

>>>>> Axel Dahmen

>>>>> www.axeldahmen.de

>>>


>

>

>

>
 
Post about such issues here instead:

http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/threads



No one here works for or represents Microsoft (including me).





Axel Dahmen wrote:

> Did you miss to send any personal response in addition to your signature?

>

> Or haven't you read my complaint about something not working in IE8

> although

> should? My posting has actually been a bug report...

>

> Thanks,

> Axel Dahmen

>

>

> --------------

> "PA Bear [MS MVP]" schrieb im Newsbeitrag

> news:#0$MXTWuKHA.1852@TK2MSFTNGP05.phx.gbl...

>> Developer-specific resources include:

>>

>> MSDN IE Development Forum (post such questions here instead)

>> http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/threads

>>

>> IE Developer Center

>> http://msdn.microsoft.com/en-us/ie/default.aspx

>>

>> Learn IE8

>> http://msdn.microsoft.com/en-us/ie/aa740473.aspx

>>

>> HTML and DHTML Overviews and Tutorials

>> http://msdn.microsoft.com/en-us/library/ms537623.aspx and

>>

>> Cascading Style Sheets (CSS)

>> http://msdn2.microsoft.com/en-us/ie/aa740476.aspx

>>

>> Expression Web SuperPreview for Internet Explorer (free, stand-alone

>> visual debugging tool for IE6, IE7, and IE8)

>> http://www.microsoft.com/downloads/...FamilyID=8e6ac106-525d-45d0-84db-dccff3fae677

>>

>> Expression Web SuperPreview Release Notes

>> http://www.microsoft.com/expression/products/Web_SuperPreviewReleaseNotes.aspx

>>

>> Validators:

>> http://validator.w3.org/

>> http://jigsaw.w3.org/css-validator/

>>

>> --

>> ~Robear Dyer (PA Bear)

>> MS MVP-IE, Mail, Security, Windows Client - since 2002

>>

>> Axel Dahmen wrote:

>>> I've just made a test:

>>>

>>> Apparently, at first start-up after machine boot,

>>> document.documentElement.clientWidth==0.

>>>

>>> Seems dangerous to me to use this property then...

>>>

>>>

>>>

>>>

>>> ---------------------------

>>> "Axel Dahmen" schrieb im Newsbeitrag

>>> news:4779441E-F33B-4212-A393-45F9F5820EF6@microsoft.com...

>>>> I've created a JavaScript checking for browser properties on load.

>>>>

>>>> From David Flanagan's book "JavaScript: The Definitive Guide", 5th

>>>> edition, published by O'Reilly, page 276, I learned that IE6+ may be

>>>> recognized from an expression like the following:

>>>>

>>>> if (document.documentElement && document.documentElement.clientWidth)

>>>> {...}

>>>>

>>>> But this expression sometimes yields false!

>>>>

>>>> I don't know yet what exactly causes the "false" condition, but it

>>>> always

>>>> happens when I start-up my machine and double-click a >>> HTML

>>>> page linking to the above JavaScript. Once reloaded this condition

>>>> always

>>>> yields "true".

>>>>

>>>> Anyone experienced this behaviour before? What would be a better

>>>> conditional expression than the one above? Explicitly checking for

>>>> undefined? Or null?

>>>>

>>>> TIA,

>>>> Axel Dahmen

>>>> www.axeldahmen.de
 
"Axel Dahmen" wrote in message

news:A5A60FEA-0BF9-4F5C-A98B-10CB5BF7FAA7@microsoft.com...

> Hi, Dan,

>

> thanks for replying.

>

> I followed a Hyperlink from the Microsoft site telling differently:

>

>

> http://www.microsoft.com/windows/internet-explorer/support/call-us.aspx

>

> "Other support options

> Leave feedback

> If you have any feedback about Internet Explorer 8, please post it

> to our newsgroup. "




Ah, that old misdirection from Microsoft. It's caught a lot of people out.



> For me this seemed the only way to get in touch with the IE development

> team. The IE8 Connect channel has been closed down and there is no new IE9

> Channel available at this time.




As I said, nobody from MS appears to monitor this group. All the public MS

newsgroups are peer-to-peer discussion, nothing more.



> I'll try to follow the forum link, however, now. I had the impression so

> far this forum was for plug-in developers only.

>

>

> Thanks, Dan & PA for enlightening me!

>

> Yours,

> Axel Dahmen






Good luck :)



Dan



>

>

>

> -------------------

> "Dan" schrieb im Newsbeitrag

> news:ACCF93C7-9204-4D69-B03E-4AF424403169@microsoft.com...

>> PA Bear sent you a list of links to various IE developer resources.

>>

>> This is just a newsgroup for users of IE to discuss things with other

>> users, not a bug reporting facility. MS dev don't monitor this group.

>> Bugs should normally be posted through the Microsoft Connect site at

>> http://connect.microsoft.com , although you'll find that the IE reporting

>> system was disabled when the beta ended. If you go to

>> https://connect.microsoft.com/IE then you'll see that under Other

>> Feedback Channels there is the IE Developer Forum - this is the first

>> link that PA Bear included in his reply, and is the only feedback

>> resource listed by MS for IE8.

>>

>> Dan

>>

>>

>> "Axel Dahmen" wrote in message

>> news:8010F3BB-9E7B-40BA-A804-3D40E07B0C86@microsoft.com...

>>> Did you miss to send any personal response in addition to your

>>> signature?

>>>

>>> Or haven't you read my complaint about something not working in IE8

>>> although should? My posting has actually been a bug report...

>>>

>>> Thanks,

>>> Axel Dahmen

>>>

>>>

>>> --------------

>>> "PA Bear [MS MVP]" schrieb im Newsbeitrag

>>> news:#0$MXTWuKHA.1852@TK2MSFTNGP05.phx.gbl...

>>>> Developer-specific resources include:

>>>>

>>>> MSDN IE Development Forum (post such questions here instead)

>>>> http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/threads

>>>>

>>>> IE Developer Center

>>>> http://msdn.microsoft.com/en-us/ie/default.aspx

>>>>

>>>> Learn IE8

>>>> http://msdn.microsoft.com/en-us/ie/aa740473.aspx

>>>>

>>>> HTML and DHTML Overviews and Tutorials

>>>> http://msdn.microsoft.com/en-us/library/ms537623.aspx and

>>>>

>>>> Cascading Style Sheets (CSS)

>>>> http://msdn2.microsoft.com/en-us/ie/aa740476.aspx

>>>>

>>>> Expression Web SuperPreview for Internet Explorer (free, stand-alone

>>>> visual debugging tool for IE6, IE7, and IE8)

>>>> http://www.microsoft.com/downloads/...FamilyID=8e6ac106-525d-45d0-84db-dccff3fae677

>>>>

>>>> Expression Web SuperPreview Release Notes

>>>> http://www.microsoft.com/expression/products/Web_SuperPreviewReleaseNotes.aspx

>>>>

>>>> Validators:

>>>> http://validator.w3.org/

>>>> http://jigsaw.w3.org/css-validator/

>>>>

>>>> --

>>>> ~Robear Dyer (PA Bear)

>>>> MS MVP-IE, Mail, Security, Windows Client - since 2002

>>>>

>>>> Axel Dahmen wrote:

>>>>> I've just made a test:

>>>>>

>>>>> Apparently, at first start-up after machine boot,

>>>>> document.documentElement.clientWidth==0.

>>>>>

>>>>> Seems dangerous to me to use this property then...

>>>>>

>>>>>

>>>>>

>>>>>

>>>>> ---------------------------

>>>>> "Axel Dahmen" schrieb im Newsbeitrag

>>>>> news:4779441E-F33B-4212-A393-45F9F5820EF6@microsoft.com...

>>>>>> I've created a JavaScript checking for browser properties on load.

>>>>>>

>>>>>> From David Flanagan's book "JavaScript: The Definitive Guide", 5th

>>>>>> edition, published by O'Reilly, page 276, I learned that IE6+ may be

>>>>>> recognized from an expression like the following:

>>>>>>

>>>>>> if (document.documentElement && document.documentElement.clientWidth)

>>>>>> {...}

>>>>>>

>>>>>> But this expression sometimes yields false!

>>>>>>

>>>>>> I don't know yet what exactly causes the "false" condition, but it

>>>>>> always

>>>>>> happens when I start-up my machine and double-click a >>>>> HTML

>>>>>> page linking to the above JavaScript. Once reloaded this condition

>>>>>> always

>>>>>> yields "true".

>>>>>>

>>>>>> Anyone experienced this behaviour before? What would be a better

>>>>>> conditional expression than the one above? Explicitly checking for

>>>>>> undefined? Or null?

>>>>>>

>>>>>> TIA,

>>>>>> Axel Dahmen

>>>>>> www.axeldahmen.de

>>>>


>>

>>

>>

>>
 
Back
Top