window.open javascript without the URL

0

I'm trying to open a new window in javascript, but without the URL ... already tried some shapes and nothing ... has anyone managed to remove it? Here is my initial test code below:

 <!DOCTYPE html>
<html>
<body>

<p>Click the button to open an about:blank page in a new browser window that is 200px wide and 100px tall.</p>

<button onclick="popupwindow()">Try it</button>

<script>
function popupwindow(url, title, w, h) {
 var w = 200;
        var h = 200;
        var left = Number((screen.width/2)-(w/2));
        var tops = Number((screen.height/2)-(h/2));

   return window.open('http://pt.stackoverflow.com/', '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+tops+', left='+left);
   //return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
} 
</script>

</body>
</html>
    
asked by anonymous 12.08.2015 / 17:01

2 answers

3

You can not hide the address bar in modern browsers.

This is a security feature of modern browsers, and there is no way to circumvent it with javascript or HTML .

Imagine that without this sites could mimic popups from other sites to try to steal passwords, for example pretending to allow on the site using facebook login, however instead of using the facebook API to show the popup it shows a false popup which imitates the original.

If you do not want to show the address bar I would say the only alternative is to use some kind of modal within the page and display the content of the popup in iframe .

    
13.08.2015 / 17:00
1

Good Night!

Your code is correct, I tested with the following browsers.

  • Mozilla Firefox Version 37.0.2
  • Google Chrome Version 44.0.2403.155 m
  • Microsoft Edge 20.10240.16384.0

I know I should not ask for clarification in the answer but at the moment I can not comment on your post, so I wonder if this is your final code, and which browser you are using.

    
13.08.2015 / 02:59