473,800 Members | 2,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to make popup *just* big enough?



My JavaScript code opens a popup window which contains some text
(with hyperlinks), and some buttons. I want this popup to be *as
small as possible*, while still showing all of its contents. Is
there any way to determine this size dynamically that will work
for all "reasonably recent" browsers (e.g. IE 6, NS 6, etc. or
newer)?

TIA,

jill

--
To s&e^n]d me m~a}i]l r%e*m?o\v[e bit from my a|d)d:r{e:s]s.

Jul 23 '05 #1
5 1710
In article <cd**********@r eader2.panix.co m>, jk*********@yah bitoo.com
enlightened us with...

My JavaScript code opens a popup window which contains some text
(with hyperlinks), and some buttons. I want this popup to be *as
small as possible*, while still showing all of its contents. Is
there any way to determine this size dynamically that will work
for all "reasonably recent" browsers (e.g. IE 6, NS 6, etc. or
newer)?

Before it opens? No. You don't know what my font size is set to if I
override yours, which many visually impaired people do. You have no way
to tell if I have my browser set to ignore your style sheet.

After it opens? You'd have to play around and then resize the window.
Resizing has many drawbacks, including problems with tabbed browsers and
browsers with resize turned off.

All that assumes your popup isn't blocked.

--
--
~kaeli~
Those who get too big for their britches will be exposed in
the end.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
In <MP************ ************@nn tp.lucent.com> kaeli <ti******@NOSPA M.comcast.net> writes:
In article <cd**********@r eader2.panix.co m>, jk*********@yah bitoo.com
enlightened us with...

My JavaScript code opens a popup window which contains some text
(with hyperlinks), and some buttons. I want this popup to be *as
small as possible*, while still showing all of its contents. Is
there any way to determine this size dynamically that will work
for all "reasonably recent" browsers (e.g. IE 6, NS 6, etc. or
newer)?
After it opens? You'd have to play around and then resize the window.


But how do I determine what to resize the window to? (I guess I
don't understand what you mean by "play around"; I'm a bit of a
newbie when it comes to JavaScript...).

jill
--
To s&e^n]d me m~a}i]l r%e*m?o\v[e bit from my a|d)d:r{e:s]s.

Jul 23 '05 #3
In article <cd**********@r eader2.panix.co m>, jk*********@yah bitoo.com
enlightened us with...
After it opens? You'd have to play around and then resize the window.


But how do I determine what to resize the window to? (I guess I
don't understand what you mean by "play around"; I'm a bit of a
newbie when it comes to JavaScript...).


Sorry, I tend to be overly vague sometimes. *heh*

By play around, I mean you'd have to try a few methods to see what
worked, because I don't know of any easy way to get the size. ;)

An idea, untested: hack your content a bit by sticking it all in a div
that is set to take up all available space, but can overflow the window
size, then get the height and width of the div if you can (browser-
dependent), then resize the window to the height and width of the div.

I don't think you can get the height of the body element itself, but you
can try. You could also try getting the document size and see if that's
it. If you can get those, I don't know if they'd give you the height and
width you'd be looking for.

--
--
~kaeli~
You feel stuck with your debt if you can't budge it.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #4
In article <MP************ ************@nn tp.lucent.com>,
ti******@NOSPAM .comcast.net enlightened us with...

An idea, untested: hack your content a bit by sticking it all in a div
that is set to take up all available space, but can overflow the window
size, then get the height and width of the div if you can (browser-
dependent), then resize the window to the height and width of the div.

I don't think you can get the height of the body element itself, but you
can try. You could also try getting the document size and see if that's
it. If you can get those, I don't know if they'd give you the height and
width you'd be looking for.


I decided to play a bit and the div idea didn't work too well in NN/Moz,
so I've gotten this far with window values. The values aren't the
greatest and more needs to be done to size properly for NN/IE, but it's
a start. Note that NN and IE come up with different numbers for the
height and the height in IE doesn't take the top of the window into
account, so it's too small a window by that amount, which will vary
system to system.

Others I tried already that didn't work well:
win.document.bo dy.offsetHeight : IE worked, NN always had 0
win.innerHeight : NN worked, IE=undefined

win.document.bo dy.clientHeight ; // IE same as OH, NN same as IH, so
kept this

Have fun. I have to go home now.

--------------test.html---------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title> New Document </title>
<script type="text/javascript" language="javas cript">
function openIt()
{
var win = window.open("te st2.html","","h eight=200,width =200");
var ch = win.document.bo dy.clientHeight ;
var cw = win.document.bo dy.clientWidth;

alert("clientHe ight: "+ch+"\n"+
"clientWidt h: "+cw);
//win.resizeTo(w, h);
//win.focus();
}
</script>
</head>

<body>
<form id="f1" name="f1">
<br>
<input type="button" name="btn1" value="try it" id="btn1"
onclick="openIt ()">
</form>
</body>
</html>

--------------test2.html---------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>test </title>
<style type="text/css">
body {
height: 100%;
width: 100%;
}
</style>
</head>

<body>
<p>this is the start of the content.</p>
<p>this is test page #2</p>
<p>this is test page #2</p>
<p>this is test page #2</p>
<p>this is test page #2</p>
<p>this is test page #2</p>
<p>this is test page #2</p>
<p>this is test page #2</p>
<p>this is test page #2</p>
<p>this is the end of the content.</p>
</body>
</html>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>test </title>
<style type="text/css">
body {
height: 100%;
width: 100%;
}
</style>
</head>

<body>
<p>this is the start of the content.</p>
<p>this is test page #2</p>
<p>this is test page #2</p>
<p>this is test page #2</p>
<p>this is test page #2</p>
<p>this is test page #2</p>
<p>this is test page #2</p>
<p>this is test page #2</p>
<p>this is test page #2</p>
<p>this is the end of the content.</p>
</body>
</html>

--
--
~kaeli~
If you don't pay your exorcist, you get repossessed.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #5
J Krugman wrote:


My JavaScript code opens a popup window which contains some text
(with hyperlinks), and some buttons. I want this popup to be *as
small as possible*, while still showing all of its contents. Is
there any way to determine this size dynamically that will work
for all "reasonably recent" browsers (e.g. IE 6, NS 6, etc. or
newer)?

TIA,

jill


Hi Jill

AFAIK: I don't think so.
The problem you face is that people can have all kind of fontsizes because
they have bad eyes or something like that. (eg fontsize=150%)

You don't have to have bad eyes even:
I have a highres monitor (21'') and often set my fontsize on Mozilla to 150%
when I hit a side where some (bad) webdesigners use an impossible small
font.

You could try to override the settings, but that is rude and very unfriendly
for that users with bad eyes.

So: In my opinion the most reasonable solution is this: Create a pop-up and
make it big enough for 100% textsize on both M$ Exploder and NS/Mozilla.
But make sure you do not add missery like 'noresize'.
That way it looks good for most people, but you also give people the
oppertunity to change your default.

Regards,
Erwin Moller
Jul 23 '05 #6

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

Similar topics

38
5092
by: Shaun McKinnon | last post by:
HI...Here's my problem...I have a popup window that loads when i want it to, but it's not sized properly. I've set the size, but it doesn't seem to work. I've been on 8 different websites to find out what i'm doing wrong, and so far it seems i'm doing it the right way. Here's my code...any suggestions would be appreciated. <script language="javascript"> <!-- window.open("256fx/index.htm", "", "height=400, width=600"); //-->
1
12533
by: amith | last post by:
Hi, I have a javascript, calendar.js which i use to enable my client to select the date. This calendar pops up on the click of a gif image. But the problem is that this poped up window is not modal in nature(i do not want the user to go the parent page unless he selects some date in the calendar popup). In the javascript calendar.js he has used window.open() function to pop up the window. i just want to know whether we have any...
26
6827
by: Raffi | last post by:
Hi, We have a database application that runs in a popup Internet Explorer application window. The reason for this is to isolate the casual user from the address bar and the typical IE navigation buttons. The application has a browser test page that displays an error message when a popup blocker is found and opens a popup page stating the test was successfull if there is no popup blocker.
23
6416
by: Markus | last post by:
Hi, i have this problem: Sometimes, i can't reproduce, if i click on an small image on the website, the popup _AND_ an other Tab in firefox open. Here are the linkcode: <div align="center">
7
2114
by: bu | last post by:
I have a form with a handful of comments fields. I am trying to code the form in such a way that when the user clicks on the field, a dialog box will open up displaying the full contents of the field. I want to reuse the same window for each field ( seems sensless to code a screen n times for n fields when the only thing that is really changing is the source data ), but am having all sorts of issues. I have tried dynamically setting the...
5
1315
by: Kyote | last post by:
Sorry, but I have no idea how to phrase the subject better than that. I've come across this a few different times and decided to ask in case there's a way to do it. It would simplify things a bit and I figured if anyone knows, more than likely that someone is here. I have a class for storing filenames and it's path along with a little more info. Here it is Public Class myFiles Public oldFileName As String
4
2442
by: Richard | last post by:
Hi, ich verwende folgenden Code, den ich im Internet gefunden habe, um Informationen auf Anfrage in Popupfenstern zu öffnen: // Script by Thomas Stich // http://www.stichpunkt.de/beitrag/popup.html // use it if you like it // // <a href="html-or.jpg" onclick="return popup(this,123,456)"
5
2461
by: Thelma Roslyn Lubkin | last post by:
I am still having trouble trying to use a popup form to allow user to set filters for the main form. The main form is based on a single table. The popup contains 5 listboxes, so the user can filter on 5 fields in this table, and can include as many field values as s/he needs. The popup is reached from a command button on the main form : This button is on the main form, Datasystem:
11
5326
by: V S Rawat | last post by:
using Javascript, I am opening a web-based url in a popup window. MyWin1=Window.Open(url, "mywindow") There is a form (form1) in the url in that popup window, I need to submit that form. How do I submit that form1 from the javascript from my current window? Thanks.
0
9690
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
9550
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10501
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
10273
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
10250
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
9085
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
6811
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();...
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.