How do I make webgl fill the browser window and resize properly

      window.addEventListener('load', resizePage, false);
      window.addEventListener('resize', resizePage, false);
    function resizePage()
    {   
        canvas.width  = window.innerWidth;
        canvas.height = window.innerHeight;
       
        window.devicePixelRatio = canvas.height/canvas.width;
}

I tried this and numerous other ways - all failed.
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
^ skews the canvas.

Tried this, couldn’t get it working.

cheers

This seems to have worked for me.

      window.addEventListener('load', resizePage, false);
      window.addEventListener('resize', resizePage, false);

function resizePage()
{   
    if (gameInstance !== undefined && gameLoaded === true)
    {
        canvas.style.width = window.innerWidth + 'px';
        canvas.style.height = window.innerHeight + 'px';
    }
   
}