Disable maximar button in popup

1

Does anybody tell me how to disable the maximize button in this popup window code?

<a onclick="window.open('http://endereco', 'aio_radio_player', 'width=720, height=355');
    
asked by anonymous 19.05.2018 / 19:07

2 answers

3

Use the resizable=no option:

window.open('http://endereco', 'aio_radio_player',
   'width=720,height=355,location=no,menubar=no,scrollbars=no,resizable=no,fullscreen=no');

I've added some more parameters for you to experience the effect of each. I recommend that you test each option individually to see what applies to you.

Note that the effectiveness of each depends on the implementation of the browser. For example, in my Firefox I disabled support for several of the window options because I found some very inconvenient (like stopping the popup in the main window).

See the MDN documentation to learn more about window.open :

  

link

Description of some properties, removed from above link:

    
19.05.2018 / 19:31
1

There is no way to disable the maximize button, because the browser does not allow such control via code (except IE, which allows, at least in version 11 tested).

But you can via JavaScript create a onresize event for the window that will prevent you from resizing (even preventing it from maximizing it). Just save the initial dimensions as variables and when you try to resize them, the script will return the window back to its original size with the resizeTo() method.

  

Note: The code will only work if the page to be opened in the window is from the same domain.

Link HTML:

<a onclick="abre('t8_1.php'); event.preventDefault()" href="#" class="lista">Abrir janela</a>

Place in onclick the function that will open the window passing as a parameter the URL of the page to be loaded. The event.preventDefault() will undo the action of clicking the link.

Function:

<script>
function abre(u){
   var popup = window.open(u,'aio_radio_player','width=720,height=355,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');

   popup.addEventListener("DOMContentLoaded", function(){
      var pu_width = popup.outerWidth; 
      var pu_height = popup.outerHeight;
      popup.onresize = function(){
         popup.resizeTo(pu_width, pu_height);
         popup.focus();
      }
   });
}
</script>

Functional example at this link

    
20.05.2018 / 00:43