I'm building a Google Chrome Extension. I want to create a popup window using the chrome.windows.create API. Everything works but I don't know how to create the window with fixed size( user can't resize the window, also the maximize button should be disabled). Is it possible to do this?

有帮助吗?

解决方案

Modern browsers such as Google Chrome tend not to allow this because it is seen as a user unfriendly limitation.

Still, you can force a window to keep its initial size using jquery as showed it this question: Disable Browser Window Resize.

var size = [window.width,window.height];

$(window).resize(function(){
    window.resizeTo(size[0],size[1]);
})
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top