Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change height of popup window

When I click on my extension icon a popup windows appears, but the problem I'm facing is that the popup windows height is too large so it gets below my taskbar. Is there anyway to set the height of the popup window?

I have tried with declaring height and width in a css file by the body tag. But only the width of the window changes. I have also tried with making an iframe, but the popup window only gets blank.

like image 240
Henrik Avatar asked Dec 03 '22 03:12

Henrik


2 Answers

Add the following at the beginning of your popup page to replace the <html>:

<!DOCTYPE html>

Good luck!

like image 58
shawn zeng Avatar answered Dec 20 '22 21:12

shawn zeng


You can set height and width of your popup window by using window.resizeTo(preferedWidth, preferedHeight) function. If you want to set this inside a popup window not from parent window than self.resizeTo(preferedWidth, preferedHeight); will do the job for you.

Better suggestion is to keep your content inside a div for example div with id 'content' so you can use this for popup window.

<head>
<script type="text/javascript">
function resizeMe()
{
    height = document.getElementById("content").offsetHeight;
    width  = document.getElementById("content").offsetWidth;
    self.resizeTo(width+20, height+100);
}
</script>
</head>

<body onload="resizeMe();">

This should be enough to solve your problem.

like image 27
Aqeel Ahmad Avatar answered Dec 20 '22 21:12

Aqeel Ahmad