Fixed window size in a chrome extension

喜欢而已 提交于 2019-12-13 06:48:43

问题


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?


回答1:


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]);
})


来源:https://stackoverflow.com/questions/23474300/fixed-window-size-in-a-chrome-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!