Doing some web crawling.
Can someone please explain to me, what the difference is, if any, between:
- Using the window-size argument when the headless chrome is instantiated:
--window-size=${width},${height}
vs
- Setting the viewport
page.setViewport({width,height});
--
I want to know whether there is any advantage to using the 1st method, over the second.
For example, in the eyes of the host, if I use a semi random width/height (ie select from a list of plausible values), will the first offer me any entropic advantage in the same way as selecting a random user agent does?
The second method, 'setViewport' method, is that simply a client side thing for rendering the actual page in the event that one wants to get a screenshot?, or, does it also notify/provide sufficient information to the host as to the nature of my virtual puters resolution ...
Many thanks.
NH
Doing some web crawling.
Can someone please explain to me, what the difference is, if any, between:
- Using the window-size argument when the headless chrome is instantiated:
--window-size=${width},${height}
vs
- Setting the viewport
page.setViewport({width,height});
--
I want to know whether there is any advantage to using the 1st method, over the second.
For example, in the eyes of the host, if I use a semi random width/height (ie select from a list of plausible values), will the first offer me any entropic advantage in the same way as selecting a random user agent does?
The second method, 'setViewport' method, is that simply a client side thing for rendering the actual page in the event that one wants to get a screenshot?, or, does it also notify/provide sufficient information to the host as to the nature of my virtual puters resolution ...
Many thanks.
NH
Share Improve this question edited May 11, 2020 at 17:47 hardkoded 21.7k3 gold badges61 silver badges74 bronze badges asked Nov 13, 2019 at 0:37 Nicholas HamiltonNicholas Hamilton 10.5k7 gold badges62 silver badges90 bronze badges1 Answer
Reset to default 7You could consider --window-size=${width},${height}
as the initial viewport.
The good thing about setViewport
is that you can change the viewPort many times. It also overrides the window size. For instance, in this image, you can see that the viewport is set to 800x800 and it won't change no matter the size of the window.
I think setViewport
will give you more flexibility, and I would consider more stable , because it guarantees that the value you set will be honored.