Solved: Using $.getScript works.
I have this script that will load 2 other scripts if you are on desktop. If you are not on desktop, those scripts won't load. This works fine.
(function () {
// Detects devices
if (isMobile.apple.device || isMobile.android.device || isMobile.seven_inch || isMobile.windows.device || isMobile.amazon.device)
{
console.log('Client is mobile. Not loading particles.');
document.getElementById("warning-mobile").style.display = 'block';
}
else
{
console.log('Client is desktop. Loading particles.');
document.writeln("<script type='text/javascript' src='https://demihypercube.space/js/particles.js'></script>");
document.writeln("<script type='text/javascript' src='https://demihypercube.space/js/app.js'></script>");
}
})();
But, document.write is not the best method. Is there another way I can load particles.js and app.js? They need to load in that order.