Change popup height

When I click on my extension icon, pop-ups appear, but the problem I am facing is that the height of the pop-ups is too high, so it gets below my taskbar. Is there a way to set the height of the popup?

I tried to declare the height and width in the css file with the body tag. But only the width of the window changes. I also tried creating an iframe, but the popup is just empty.

+4
source share
3 answers

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

 <!DOCTYPE html> 

Good luck

+11
source

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

The best suggestion is to keep your content inside a div, like a div with id 'content', so that you can use it for a popup.

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

+5
source

Try:

 <style type="text/css"> body { max-height: 300px; } </style> or just, <style type="text/css"> body { height: 300px; } </style> 

In the <head> your popup.html.

0
source

Source: https://habr.com/ru/post/1332617/


All Articles