Answer the question
In order to leave comments, you need to log in
Is it possible to edit the page code with a script while it is loading?
Let's say there is a page code for a regular site. In it, I want to add a button through a tampermonkey script.
But my self-written button will be displayed only after the page is fully loaded. I am aware that it is possible to render after a full load, with scripts already applied. But the question is, is it possible to change the page code during loading, so that my button appears along with the default ones, as if it were by default? How to embed between loading html and its display.
I have little to no understanding of the page load hierarchy, so I apologize in advance for possible stupidity.
Answer the question
In order to leave comments, you need to log in
I solved the problem by running a script with the very start of the page via // @run-at document-start, created a function for tracking the appearance of standard buttons, and actually screwed the addition of custom buttons to this self-written "event".
Yes, you can. There are two events. One is onload after loading and the other is onDOMContentLoaded after DOM parsing.
The first one will be executed after loading all scripts, styles, pictures,
and the second one right after reading the HTML.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question