0

Browser Details using JavaScript

asked 2009-04-24 04:55:16 +0800

Dhanapalan gravatar image Dhanapalan
159 2

Hi,
I'm trying to get browser width/height using java script, unable to execute java script ,its giving error. Please help me out.

<script type="text/javascript"><![CDATA[

function getBrowserWidth()
{
return document.compatMode=='CSS1Compat'&&!window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}
function getBrowserHeight()
{
return document.compatMode=='CSS1Compat'&&!window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}
]]></script>

<window id="wind" width="" onClientInfo="getBrowserWidth()">

</window>


Thanks,
Dhana

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2009-04-24 07:48:16 +0800

hideokidd gravatar image hideokidd
750 1 2

Hi,

1.Any error message?

2.Searching on forum with keyword browser width you will get others' solutions and issues,
for example,http://www.zkoss.org/forum/index.zul#path%3DlistComment%3BdiscussionId%3D7367%3BcategoryId%3D14%3B

link publish delete flag offensive edit

answered 2009-04-24 10:40:09 +0800

Dhanapalan gravatar image Dhanapalan
159 2

Hi,

I got following error.

Sourced file: inline evaluation of: ``getBrowserWidth();'' : Command not found: getBrowserWidth() : at Line: 1 : in file: inline evaluation of: ``getBrowserWidth();'' : getBrowserWidth ( )

I tried your example code. that works for me. thanks for quick resposne.

Regards,
Dhana

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-04-24 04:55:16 +0800

Seen: 193 times

Last updated: Apr 24 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More