Any way to resize the pop window size from withthin the popup.html ?

6,756 views
Skip to first unread message

CqN on cr-48 devchannel 0.12.397.0

unread,
May 5, 2011, 12:31:03 AM5/5/11
to Chromium-extensions
Is it possible to resize a pop up window from the js or html file? I
have an extension where it is desirable, when some configuration is
done by the user, to resize the winodw for a better fit. Yes, of
course the user can currently manually resize the extension, but I
want the ext script to use it dynamically. Possible?

CqN

Arne Roomann-Kurrik

unread,
May 25, 2011, 3:34:19 PM5/25/11
to CqN on cr-48 devchannel 0.12.397.0, Chromium-extensions
Are you referring to a browser action popup window?  That will resize automatically to fit its own contents.

~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.


Chacko

unread,
May 25, 2011, 5:38:11 PM5/25/11
to kur...@chromium.org, Chromium-extensions
Yes, it is a browser action popup.  Corrrect, it auto resizes.  But as  media player (audio vs vedio) is used as result of user action, the webkit meidal player's auto sizing turns out to be non optimal.  So if I can resize at that point (afer knowing what type of media is going to be player), I can present a much nicer/optimally sized popup frame.

CqN

Scott Fujan

unread,
May 25, 2011, 7:13:11 PM5/25/11
to Chacko, kur...@chromium.org, Chromium-extensions
You can set the size of the <html> element.

Arne Roomann-Kurrik

unread,
May 26, 2011, 2:34:41 PM5/26/11
to Scott Fujan, Chacko, Chromium-extensions
Yeah, you should be able to set an explicit size by adjusting any wrapper DOM element's width and height style properties.

~Arne

Martin Sikora

unread,
May 27, 2011, 3:23:30 AM5/27/11
to Chromium-extensions
I always resize popup manually:

$('body').height(height);
$('html').height(height);

If there was a way to do it automatically I would appreciate it

On May 5, 6:31 am, "CqN on cr-48 devchannel 0.12.397.0"

CqN on cr-48 devchannel 0.12.397.0

unread,
May 27, 2011, 4:20:42 PM5/27/11
to Chromium-extensions
Hmm... either of below from a js script

$('body').height(280);
$('html').height(280);

produces script error on running,
Uncaught TypeError: Cannot call method 'height' of null

What gives?

CqN

On May 27, 12:23 am, Martin Sikora <lazyeurop...@googlemail.com>
wrote:
> I alwaysresizepopup maually:
>
> $('body').height(height);
> $('html').height(height);
>
> If there was awayto do it automatically I would appreciate it
>
> On May 5, 6:31 am, "CqN on cr-48 devchannel 0.12.397.0"
>
>
>
>
>
>
>
> <chackoner...@gmail.com> wrote:
> > Is it possible toresize apopupwindowfrom the js or html file? I
> > have an extension where it is desirable, when some configuration is
> > done by the user, toresizethe winodw for a better fit.   Yes, of
> > course the user can currently manuallyresizethe extension, but I

PhistucK

unread,
May 30, 2011, 2:10:53 AM5/30/11
to CqN on cr-48 devchannel 0.12.397.0, Chromium-extensions
In jQuery, if the element does not exist, calling height on it does not trigger an error of any sort, it fails silently and script execution goes on.
In your case, it does fail, so it looks like $ does not exist. Are you sure jQuery is fully loaded at the time of executing this code?

PhistucK



CqN on cr-48 devchannel 0.12.397.0

unread,
May 30, 2011, 11:31:41 AM5/30/11
to Chromium-extensions
PhistucK,

Is jQuery essential for this to work? I have $() defined to return
document.getElementById(), which works in many places in the code.
But I do not use jQ in this app.

CqN

Re: [crx] Re: Any way to resize the pop window size

On May 29, 11:10 pm, PhistucK <phist...@gmail.com> wrote:
> In jQuery, if the element does not exist, calling height on it does not
> trigger an error of any sort, it fails silently and script execution goes
> on.
> In your case, it does fail, so it looks like $ does not exist. Are you sure
> jQuery is fully loaded at the time of executing this code?
>
> ☆*PhistucK*
> > To post to this group, send email to chromium-extensi...@chromium.org.
> > To unsubscribe from this group, send email to
> > chromium-extensions+unsubscr...@chromium.org.

PhistucK

unread,
May 30, 2011, 11:38:23 AM5/30/11
to CqN on cr-48 devchannel 0.12.397.0, Chromium-extensions
Yes, it does, in the this form of coding.
1. $ mapped to document.getElementById would not return the body element, it would return null.
2. There are no DOM functions named height/width, you need to use bodyElement.style.height and bodyElement.style.width (where bodyElement is just a variable, of course).
PhistucK



To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
Reply all
Reply to author
Forward
0 new messages