We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

element.onresize Redirect 1

The GlobalEventHandlers.onresize property contains an EventHandler triggered when a resize event is received.


window.onresize = funcRef;


  • funcRef is a reference to a function.


window.onresize = doFunc;

<title>onresize test</title>


<p>Resize the browser window to fire the resize event.</p>

<p>Window height: <span id="height"></span></p>
<p>Window width: <span id="width"></span></p>

<script type="text/javascript">
  var heightOutput = document.querySelector('#height');
  var widthOutput = document.querySelector('#width');

  function resize() { 
    heightOutput.textContent = window.innerHeight;
    widthOutput.textContent = window.innerWidth;

  window.onresize = resize;


The resize event is fired after the window has been resized.


Specification Status Comment
WHATWG HTML Living Standard
The definition of 'onresize' in that specification.
Living Standard  

Document Tags and Contributors

 Last updated by: Sheppy,