Greasemonkey/Tampermonkey Adding new Javascript at end of page

635 Views Asked by At

I'm Making a simple script with Tampermonkey, its shows information about people connected to my teamspeak server.

So this is my code

window.addEventListener('load',function() { $("body").append ( ' [SOME JAVASCRIPT CODE]' ); }, true);

But for some reason Its not working, but if I change the code to normal html text it works without errors.

The javascript code its working separately, and this is the code (something like this)

<script type="text/javascript">
<!--
var ouvert = 1;
var style = "classic";
var couleur_fond = "FFFFFF";
var couleur_texte = "666666";
var largeur = 390;
var hauteur = 350;
var ip = "aphrodite.ts3-serveur.com";
var port = 13500;
var query = 62101;
var lang = "en";
var taille_police = 12;
var voir_salons = 1;
//-->
</script>
<script type="text/javascript" src="http://www.ts3-serveur.com/web_script/webscript_ts3.js"></script>

Any tip why its not working?

1

There are 1 best solutions below

0
On

There is a bug in the current Tampermonkey version that prevents the "load" callback from being fired. You can either wait for the next beta version or use "DOMContentLoaded" as a workaround.

Note: make sure you've set

// @run-at         document-start

at the script header.