Js method for obtaining the page height and width
The method of retrieving the width and height of the parent page is used in the pop-up dialog. For more information, see
When a pop-up dialog is made today, the width and height of the parent page are used.
Tried several methods, such as document. body. clientWidth, window. screen. width, document. body. after scrollWidth and other methods, I found that none of them were my desired results. Later I found an efficient method. I will share it with you immediately:
Add a breakpoint to debug the [debugger] where the height and width are required, and then enter document on the monitoring page. body, view the attributes of all the bodies to see which result is needed. If not, enter the window and check whether there is a suitable attribute in the window, today, my problem is solved in this way. The attribute is window. innerWidth and window. innerHeight.
We hope that you can avoid detours when encountering such problems.