Open doctor8296 opened 6 months ago
It does but its a race-condition. Sometimes the script loads faster sometimes tampermonkey.
Try using the "defer" attribute in your script tag on your website
@emlinhax well, so there is no guarantees unfortunately :( In my case User script works out everytime faster than site. Also Tampermonkey have such option as inject mode instant, so there is definitely no way to avoid it at that point.
I am here because I faced with the problem that even content script inserted in very start of the html can be handled and deleted before its execution.
Do you have any ideas how can we at least guaranteed to run own scripts ?
I am working on browser anticheats for quite very long time and even came up with perfect universal solution, but it all breaks because of the fact I mentioned above (script removal before execution)
I mean anyone can always get a different extension (adblocker-like) to get rid of the script tag. You should add some kind of integrity checks to your code to make sure the script executed.
Maybe set a global variable within your script and in the game code then check if the variable is set or not. You are obviously gonna have to hide the code somehow (obfuscation or else).
Regarding Instant Inject: From my own experience I can say that even with instant mode it worked 50% of the time.
Yeah global variable is indeed what we can use. But hacker just can set it up instead of your script :(
:(