admin管理员组文章数量:1287561
How to disable maximise option in browser using javascript. I have tried the below code but is not working in some browsers. Is there any other option?
function onReady() {
window.open("","myWindow","resizable=no");
}
How to disable maximise option in browser using javascript. I have tried the below code but is not working in some browsers. Is there any other option?
function onReady() {
window.open("https://www.google..au","myWindow","resizable=no");
}
Share
Improve this question
edited Dec 23, 2016 at 10:56
A user
1,1083 gold badges20 silver badges47 bronze badges
asked Dec 23, 2016 at 10:12
Jithesh GopinathanJithesh Gopinathan
4485 silver badges20 bronze badges
6
- By maximize you mean fullscreen? Or "resize browser to screen size"? – Foaster Commented Dec 23, 2016 at 10:14
- so in which browsers it worked? and in which browsers it didnt work? – A user Commented Dec 23, 2016 at 10:14
- stackoverflow./questions/2048935/… Does this help you? You can implement the answer counter wise – A user Commented Dec 23, 2016 at 10:16
- @Foaster I dont want the browser size to be changed. – Jithesh Gopinathan Commented Dec 23, 2016 at 10:19
- 1 This is a horrible idea and it's good it can't be done, you just can't interfere with user devices like that... If any page would do things like that I would close it and never open again... You should rather cater every resolution or point the user to the right one, when things like portrait VS landscape are your problem. But just resizing his browser window to YOUR needs is a big nonono from me and every sentient web dev... – Foaster Commented Dec 23, 2016 at 10:26
3 Answers
Reset to default 3You probably can't do that anymore.
According to MDN, the dialog
option will do that, but it will only remove the buttons, not the menu mands for it.
function onReady() {
window.open("https://www.google..au","myWindow","dialog=yes,resizable=no");
}
But, you can only use it with "Chrome" privileges, which you probably don't have.
Also be aware that if you're calling this in response to jQuery's ready
pseudo-event as the name of the function implies, at least some browsers will prevent your code from opening that window because it's not in direct response to a user event. But if you're calling it in response to a user event, that's not an issue.
You cannot (consistently). Deliberately malicious actions are generally restricted by browsers.
But what You can do is..
window.open("mypage.html","mywindowname", "toolbar=no,menubar=no");
WIll give you a new window without the menubar and without the toolbar. If you just want to disable the functionality while still showing the buttons, then you can't.
Look Here for a reference on the window.open() method.
Try this
window.onresize = function()
{
window.resizeTo(500,500);
}
window.onclick = function()
{
window.resizeTo(500,500);
}
</script>
本文标签: jqueryHow to disable maximize option in browser using javascriptStack Overflow
版权声明:本文标题:jquery - How to disable maximize option in browser using javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741268796a2368921.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论