Iam trying to start my script after another script finished his work and returned rt():adv.bind to console. The script is running in an iframe. I tried it with window.addEventListener but the script still fires too early. How can I delay the start of my script to the end?
Myscript
window.addEventListener ("load", start, false);
function start () {
console.log("Start - Script");
}
Console Log
unreachable code after return statement[Weitere Informationen]script.packed.2254.js:1:25167
unreachable code after return statement[Weitere Informationen]script.packed.2254.js:1:25719
unreachable code after return statement[Weitere Informationen]script.packed.2254.js:1:26637
Start – Script myscript.user.js:9:1
unreachable code after return statement[Weitere Informationen]script.packed.2254.js:1:19880
unreachable code after return statement[Weitere Informationen]script.packed.2254.js:1:20902
unreachable code after return statement[Weitere Informationen]script.packed.2254.js:1:23477
unreachable code after return statement[Weitere Informationen] t.js:7:3294
rt():in true false popunder 1 t.js:12:2056
rt():adv.bind t.js:12:2106
Situation
I have a website with an embedded videojs player and iam trying to start the video automatically after loading the site. The player and my script are running inside an iframe otherwise I can't use the functions
document.querySelector('#videooverlay').click();
olvideo.player.play();
It's working already in chrome but in FF the player starts loading and stops a few seconds later. I thought maybe FF needs longer to load the site and the player isn't ready when I call the function. So if I can delay my script after the rt():advbind I would know if this is the problem.
Use setTimeout to delay your script