Redirect Page for External URLs

In general it’s just checking if you’re on an Article Page, looping through all <article> Tags, finding the actual Tag of the Content in it, looping through all <a> Tags in there and if their href isn’t an official site (using some basic RegExp for that) adding the Exit Page URL in front.
But I’m still struggling at finding out how to run the JS Code after the Page has loaded and all dynamic content (such as Posts) have been loaded. A temporary solution would be to just run the Code after 1-2 seconds, but that isn’t that great and for some people it might take more than that to load…

2 Likes