The easiest way I am aware of is UV4L, because you can get a video stream or JPEG pictures in real-time of what the Raspberry Pi is displaying on the HDMI screen connected to it (or would be displaying, if you do not have an HDMI screen connected). It's easy because you just open the browser and type the correct URL (e.g. http://rpi_address:8080/stream/webrtc) to start the stream in the page. There is also a button to record the video in standard .webm. Furthermore, it's possible to send key strokes from your PC to the Raspberry Pi to control it from within the browser itself, but this is another story. You do not necessarily need an X server running on your Rpi.
To do this, you will have to install the
raspidisp driver by following these instructions which mention this about raspidisp at the bottom of the page:
The raspidisp driver turns HDMI-out into a virtual
Video4Linux-compliant input device (like a camera). You do not
necessarily need a display connected to the Raspberry Pi HDMI-out
port. In other words, this driver can capture whatever you see or
would see on the screen.
This is useful if you have an headless Raspberry Pi. With the help of
the UV4L Streaming Server you can have full control of the Raspberry
Pi from within any browser (running on a PC in the same network, for
example). In facts, it’s possible to stream the frame buffer of
Raspberry Pi to a standard web page in the browser (plugin-free) with
very low latency and, at the same time, forward keyboard or mouse
input events from the PC to the Raspberry Pi. If you want to try this,
apart from uv4l-raspidisp, the uv4l-raspidisp-extras package has to be
$ sudo apt-get install uv4l-raspidisp-extras
The above package includes a system service that automatically starts
an uv4l instance at boot and, if installed, also an instance of the
Streaming Server listening to port 9080 by default. The service
instructs uv4l to parse the configuration file
/etc/uv4l/uv4l-raspidisp.conf for the initial setting values.
This is a DEMO, more focused on showing its read-time capabilities, but you can get the idea.