popup window too tall

895 views
Skip to first unread message

Paolo Casaschi

unread,
May 4, 2011, 8:28:27 AM5/4/11
to Chromium-extensions
hello,

my extension has a popup browser action window.

If the browser is maximized, usually there is no problem with the
height of the popup window, with scrollbars appearing when required.

However, if the browser is not maximized and the browser window is in
the middle of the screen, the popup window extends below the screen
bottom end.

The same (popup extending below the screen bottom end) happens with
some notebooks with a 600px tall screen.

How to correct the problem and make so that the popup always stays
within the available screen space?

I know how to set the height of the page and force scrollbars
otherwise, but how do I detect the maximum popup height that would fit
the screen?
Honestly, I'd expect chrome to detect and set this for me
automatically, but it does not happen...

TIA

Sam Kerner

unread,
May 4, 2011, 12:52:21 PM5/4/11
to paoloc...@gmail.com, chromium-...@chromium.org
Are you setting the height of any elements in the popup?

Paolo Casaschi

unread,
May 4, 2011, 12:59:46 PM5/4/11
to Chromium-extensions
> Are you setting the height of any elements in the popup?
>

No. In fact the actual content is dynamically created using javascript
so I cant predict how tall the content will be.

The extension looks into the active page for certain type of links
(any link whose href property meets a given regexp). The popup page
then displays a list of those links, so sometimes there's just a few
(even one) or there could be few dozens. I cant predict how long the
list will be.

The list is dynamically created preparing the corresponding HTML into
a variable then injected in the page with something like this:
document.getElementById("container").innerHTML = linkListInHTML



Paolo Casaschi

unread,
May 4, 2011, 1:07:00 PM5/4/11
to Chromium-extensions
More than a clumsy description, the popup.html code is here:

http://code.google.com/p/pgn4web/source/browse/trunk/chrome-extension/popup.html

Arne Roomann-Kurrik

unread,
May 4, 2011, 1:19:21 PM5/4/11
to Paolo Casaschi, Chromium-extensions
What happens if you put

<!DOCTYPE html> 

on the first line of that file?

~Arne


--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.


Paolo Casaschi

unread,
May 4, 2011, 2:09:47 PM5/4/11
to Chromium-extensions
> What happens if you put
>
> <!DOCTYPE html>
>
> on the first line of that file?
>

It does not make any difference.

Still on my 1024x600 netbook, even when chrome is maximized, the popup
page expands well below the biottom of the screen... even when the
vertical scrollbar shows up. It really looks like chrome fails to
detect properly how much space is available for the popup page.

Lodlock

unread,
May 9, 2011, 7:14:32 AM5/9/11
to Chromium-extensions
Try adding:

min-height:100px; max-height:600px;

to your body css. Maybe set the max-height to 500ish since you need to
give a little room for the tab bar etc. Also the max height can be
determined through javascript based on the users resolution.

-Lodlock

Paolo Casaschi

unread,
May 9, 2011, 4:18:06 PM5/9/11
to Chromium-extensions
I ended doing something like you suggested, with a max-height setting
for the main container of the variable length item list.
I'm just surprised that chrome fails detecting properly the available
space.
Reply all
Reply to author
Forward
0 new messages