I have many websites that has the following script tag in the head section:
<html>
<head>
<script>
window.doSomething(someObject);
</script>
</head>
<body>
.....
</body>
</html>
Now, I want to inject a script before any page loads so that these websites will have the access to the function doSomething
which is defined my custom script. How do I make sure that my custom script is executed before any of the scripts in the HTML file?
I don't want to modify the front-end code. I thought of using extensions but they run after all the scripts on the page. Is there a way I can do this?
Even a Chrome specific way would suffice.