(UPDATED) I am trying to make a certain div show when the user's browser is detected. I found the code online and am not sure if it even works or how to put a div in the certain browser sections of the code.
<script>
function BrowserDetection() {
if(!navigator || !navigator.userAgent) {
// Insert condition for old browsers
}
else if (navigator.userAgent.search("MSIE") >= 0) {
// Insert conditional IE code here
}
else if (navigator.userAgent.search("Chrome") >= 0) {
alert('code');
}
else if (navigator.userAgent.search("Firefox") >= 0) {
// Insert conditional Firefox Code here
}
//Check if browser is Safari
else if (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0) {
// Insert conditional Safari code here
}
//Check if browser is Opera
else if (navigator.userAgent.search("Opera") >= 0) {
// Insert conditional Opera code here
}
}
</script>
This one does not seem to work. Would anyone know where I could possibly find a working code. Thank you very much..