So I have a small script that only works correctly in Chrome, this is not a big problem, Although it is annoying with its negative effects in other browsers, I will run it only in Chrome.
This is my current work script that runs in all browsers:
function psn () {var myElement = document.getElementById ('noti'); If (window.addEventListener) {// normal browsers myElement.addEventListener ('DOMSubtreeModified', content changed, incorrect); } And if (window.attachEvent) {// IE myElement.attachEvent ('DOMSubtreeModified', changed the content); } FunctionChanged function () {// This function will run the document.getElementById ('audiotag1') of the DIV conversion every time. Var vid = document.getElementById ("audiotag1"); Vid.volume = 1; }} SetTimeout (function () {psn ()}, 2000);
And that's what I've already tried to run in Chrome, so that the script has stopped working all at once:
function Psn () {Var myElement = document.getElementById ('noti'); If (window.addEventListener) {// normal browsers myElement.addEventListener ('DOMSubtreeModified', content changed, incorrect); } And if (window.attachEvent) {// IE myElement.attachEvent ('DOMSubtreeModified', changed the content); } FunctionChanged function () {// This function will run the document.getElementById ('audiotag1') of the DIV conversion every time. Var vid = document.getElementById ("audiotag1"); Vid.volume = 1; }} Var is chrome = !! Window. Chrome; If (isChrome) {setTimeout (function () {psn ()}, 2000); }
Does anyone know why this is completely stopping everything?
It is best to identify specific browsers, but it is an easy way to see that you use Chrome Whether or not the following are:
var isChrome = navigator.userAgent.toLowerCase () .indexOf ("chrome") & gt; = 0? right wrong;
It will populate either true
with false
with Chrome.
Comments
Post a Comment