Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dynamically change the size of popup.html for Google Chrome extensions

The goal is to change the size of my chrome extension popup (different from a normal popup window) dynamically when the user clicks on a button.

I tried to hide the elements I have on the page by setting the hidden attribute to true. I also tried to change the window size with window.resizeTo, but nothing works.

Note: I can enlarge the window, but I can't shrink it back

like image 784
Tony Stark Avatar asked Oct 29 '25 18:10

Tony Stark


1 Answers

Just adjust the css width property of <body> element. Can also do the same with <html> for good measure.

document.body.style.width="100px";
document.getElementsByTagName("html")[0].style.width="100px";
like image 110
serg Avatar answered Oct 31 '25 09:10

serg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!