473,396 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

In MSIE/javascript how do I tell if an IFRAME has a vertical scrollbar or not?

This is a javascript question, possibly somewhat inappropriate for this group,
but here we go: (please redirect me to the right place to ask).

In Microsoft Internet Explorer (5 and up) using Javascript how do I detect
whether an IFRAME is displayed with or without a vertical scrollbar? The
initial height of an IFRAME is fixed, so depending on the content, the browser
will render it with a scrollbar or not.

In Netscape et al. this is easy - when iframeobj.contentWindow.scrollMaxY==0,
there is no scrollbar.

I've spent quite a few hours googling, but found nothing.

I'm using iframes as I need to use 2 or more different charactersets on the
same page. (Alternative being converting everything into UTF8 which I am hoping
to avoid).

MTIA.
--
Per Jessen, Zurich
Let your spam stop here -- http://www.spamchek.com

Jul 23 '05 #1
2 6491


Per Jessen wrote:

In Microsoft Internet Explorer (5 and up) using Javascript how do I detect
whether an IFRAME is displayed with or without a vertical scrollbar? The
initial height of an IFRAME is fixed, so depending on the content, the browser
will render it with a scrollbar or not.


You can compare
document.body.clientWidth
to
document.body.offsetWidth
for the document in the iframe, these values differ by the width of the
scrollbar. Note that for IE 6 in standards compliant mode you need to
compare
document.documentElement.clientWidth/offsetWidth

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Martin Honnen wrote:
In Microsoft Internet Explorer (5 and up) using Javascript how do I detect
whether an IFRAME is displayed with or without a vertical scrollbar? The
initial height of an IFRAME is fixed, so depending on the content, the
browser will render it with a scrollbar or not.


You can compare
document.body.clientWidth
to
document.body.offsetWidth
for the document in the iframe, these values differ by the width of the
scrollbar. Note that for IE 6 in standards compliant mode you need to
compare document.documentElement.clientWidth/offsetWidth


Martin,

thank you very much! *exactly* what I needed.
/Per

--
Per Jessen, Zurich
Let your spam stop here -- http://www.spamchek.com

Jul 23 '05 #3

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

Similar topics

2
by: Don Schneider | last post by:
I tried to setup a frameset which consists of 4 different subframes. Each of these subframes should fetch a different web page from the internet and display it completely (!). BUT: the vertical...
5
by: Z | last post by:
Hi, I have problem with auto-scrolling frames in IE (6.0 on Xp, but same happens with IE 5.5 on Win2k): If I set scrolling="auto" to frame, IE reserves space where vertical scrollbar normally...
2
by: Nathan Wallace | last post by:
When in quirks mode, IE seems to be able to display pages without any vertical scrollbar: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <style> body {...
4
by: Rob T. | last post by:
I am using a div tag to make an element that contains some text. I have specified overflow: auto; in my stylesheet. If I use font-size/line-height to specify the font information I get a vertical...
3
by: buht | last post by:
Hello Everyone, Fairly new to c# here and have a question regarding scrollbars, particularly a vertical scrollbar. It looks like my options are restricted for the textbox scrollbars being...
1
by: SJ | last post by:
Is it possible to have a Listbox with no scrollbar? I have 3 items in my listbox, and I have the Rows property set to 3. It still shows me the scrollbar. Any way to get rid of the vertical...
1
by: platoon1sc | last post by:
Hi guys.I have a problem with Internet Explorer in my web-application. I have a vertical scrollbar into my jsps but firefox show the vertical srollbar, but IE doesn't. IE show a blank space where...
1
by: Tom | last post by:
First, I posted a similar request for help in another group and now don't find the posting. Problem with my newsreader perhaps ... but apologies if this appears as a cross posting. My code is...
1
by: webdev1 | last post by:
Hi, I have set scrolling="auto" in my iframe, so when the height of iframe(Content) is more than the allocated height, vertical scrollbar appears.....Works perfect in Firefox, but when it comes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.