I\'m trying to modify an existing webpage by inserting my own Javascript file in it. I\'m setting a background Image for this webpage by inserting a new Div through my Javascrip
document.addEventListener("DOMContentLoaded", function() { var ie = document.getElementsByClassName("ie"); if(ie.length > 0) { alert("It's IE!"); } }
This should answer your first question, although I agree that there are better solutions for your overall goal.