Search code examples
javascripthtmlwindowsyntax-error

trying to open a new window in HTML with window.open not working


I'm trying to open a new window when I press a button but my code is not working. I get the error "Uncaught SyntaxError: missing ) after argument list". I can't find what I am doing wrong

<HTML>
<body>
  <button id="open_window" onclick="window.open(https://www.google.com, height=570, width=520);"></button>
  <style>
  #open_window{
      position: fixed;
      width: 15%;
      height: 15%;
      left: 35%;
      top: 35%;
      }
  </style>
</body>
</HTML>

Solution

  • Url should be quoted

     <button id="open_window" onclick="window.open('https://www.google.com', height=570, width=520);"></button>