When I was making a pop-up dialog today, I encountered the method of getting the width and height of the parent page.
After trying several methods, such as document.body.clientWidth, window.screen.width, document.body.scrollWidth and other methods, I found that none of them were the results I wanted. Later I found an efficient method. , share it with everyone immediately:
Add breakpoint debugging [debugger] where you need to get the height and width, then enter document.body in the monitoring page, check all body attributes to see which result you need Yes, if it is not suitable, you can also enter window, and then see if there are suitable attributes under the window. My problem was solved in this way today. The attributes are window.innerWidth and window.innerHeight.
I hope everyone can avoid detours when encountering such problems.