Skip to content Skip to sidebar Skip to footer

Why I Am Getting This Error With The Script In My Website?

I am trying to fix the problem that I am facing with JQuery LavaLamp Menu Bar in my website by adding the following bunch of code suggested by one of the amazing developers and peo

Solution 1:

The closing script tags are likely being interpreted by the browser as the end of the current script block even though they're inside a string literal, which in turn means that particular string literal is unterminated.

Within your string, instead of

'</script>'

You can do

'<\/script>'

(When the JS runs the backslash is ignored.) Or sometimes you see something like:

'<' + '/script>'

Or replace the < with the equivalent character code:

'\x3C/script>'

Solution 2:

Try this, Use the below function to get the browser version number

functiongetInternetExplorerVersion()
    // Returns the version of Internet Explorer or a -1// (indicating the use of another browser).
    {
        var rv = -1; // Return value assumes failure.if (navigator.appName == 'Microsoft Internet Explorer') {
            var ua = navigator.userAgent;
            var re = newRegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
            if (re.exec(ua) != null)
                rv = parseFloat(RegExp.$1);
        }
        return rv;
    }

and below for getting the browser name

var browser_type = navigator.appName ("Microsoft Internet Explorer")

so your new function would look like

   if (getInternetExplorerVersion() < 9.0 && browser_type  = "Microsoft Internet Explorer") {
    document.getElementsByTagName("head")[0].innerHTML = "<scripttype='text/javascript'src='./Scripts/jquery.easing.1.1.js'></script><scripttype='text/javascript'src='./Scripts/jquery.preloader.js'></script><scripttype='text/javascript'src='./Scripts/jquery.lavalamp.js'></script><scripttype='text/javascript'src='./Scripts/lavalamp-config.js'></script>";
 }  else {
       document.getElementById("head")[0].innerHTML = "<scripttype='text/javascript'src='./Scripts/jquery.easing.1.1.js'></script><scripttype='text/javascript'src='./Scripts/jquery.preloader.js'>";
   }

Post a Comment for "Why I Am Getting This Error With The Script In My Website?"