0

I came across an issue in my website which I have not yet been able to figure out. I am not very familiar with js.

See error message image here

Below is the code from the js file that is throwing this error.

var dtGlobals = {};
(dtGlobals.isMobile = /(Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|windows phone)/.test(navigator.userAgent)),
    (dtGlobals.isAndroid = /(Android)/.test(navigator.userAgent)),
    (dtGlobals.isiOS = /(iPhone|iPod|iPad)/.test(navigator.userAgent)),
    (dtGlobals.isiPhone = /(iPhone|iPod)/.test(navigator.userAgent)),
    (dtGlobals.isiPad = /(iPad)/.test(navigator.userAgent)),
    (dtGlobals.isBuggy = navigator.userAgent.match(/AppleWebKit/) && "undefined" == typeof window.ontouchstart && !navigator.userAgent.match(/Chrome/)),
    (dtGlobals.winScrollTop = 0),
    (window.onscroll = function () {
        dtGlobals.winScrollTop = void 0 !== window.pageYOffset ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
    }),
    (dtGlobals.isWindowsPhone = navigator.userAgent.match(/IEMobile/i)),
    (dtGlobals.customColor = "red"),
    dtGlobals.isMobile ? (document.documentElement.className += " mobile-true") : (document.documentElement.className += " mobile-false"),
    (dtGlobals.logoURL = !1),
    (dtGlobals.logoH = !1),
    (dtGlobals.logoW = !1),
    jQuery(document).ready(function ($) {
        var e = $(document),
            t = $(window),
            n = $("html"),
            o = $("body");
        if (
            (dtGlobals.isiOS ? n.addClass("is-iOS") : n.addClass("not-iOS"),
            !$.browser.webkit || dtGlobals.isMobile ? o.addClass("not-webkit").removeClass("is-webkit") : o.removeClass("not-webkit").addClass("is-webkit"),
            jQuery.browser.msie && 10 == jQuery.browser.version && o.addClass("ie-10"),
            ($.browser.safari = $.browser.webkit && !/chrome/.test(navigator.userAgent.toLowerCase())),
            $.browser.safari && o.addClass("is-safari"),
            dtGlobals.isWindowsPhone && o.addClass("ie-mobile").addClass("windows-phone"),
            dtGlobals.isMobile || o.addClass("no-mobile"),
            dtGlobals.isiPhone && o.addClass("is-iphone"),
            !$("html").hasClass("old-ie"))
        ) {
            (dtGlobals.isPhone = !1), (dtGlobals.isTablet = !1), (dtGlobals.isDesktop = !1);
            var r = window.getComputedStyle(document.body, ":after").getPropertyValue("content");
            -1 != r.indexOf("phone") && dtGlobals.isMobile ? (dtGlobals.isPhone = !0) : -1 != r.indexOf("tablet") && dtGlobals.isMobile ? (dtGlobals.isTablet = !0) : (dtGlobals.isDesktop = !0);
        }
        $.browser.msie && $("html").removeClass("csstransforms3d");
        var i;
        dtGlobals.isMobile && !dtGlobals.isWindowsPhone
            ? $(window).bind("orientationchange", function (e) {
                  clearTimeout(i),
                      (i = setTimeout(function () {
                          $(window).trigger("debouncedresize");
                      }, 200));
              })
            : $(window).on("resize", function () {
                  clearTimeout(i),
                      (i = setTimeout(function () {
                          $(window).trigger("debouncedresize");
                      }, 200));
              });
    });
James Z
  • 12,209
  • 10
  • 24
  • 44
  • [$.browser()](https://api.jquery.com/jQuery.browser/) was deprecated and removed from jQuery a long time ago. Did you do a version upgrade? – charlietfl Sep 01 '20 at 23:40
  • @charlietfl No, I did not do a version upgrade. I notice that Wordpress got updated to the latest version but I have not upgraded any of the code for about 2 years and this was fully working until a few weeks ago – user1465076 Sep 02 '20 at 00:06
  • 1
    Ok, so possibly your template got upgraded and included a higher version of jQuery. You can copy the function from https://stackoverflow.com/questions/14798403/typeerror-browser-is-undefined – charlietfl Sep 02 '20 at 00:09
  • Got it. Thank you @charlietfl and whoever posted that answer on the other thread. you made my day. Thank you again. – user1465076 Sep 02 '20 at 00:21

1 Answers1

0

Seems you got it working, but this issue was fixed by the theme developer. Just need to update the7 theme. I had the same problem with a client who had someone build their site years ago but did not maintain it.

You might be on version 3 or 4 and it is currently version 9. The upgrade process has a few steps to be mindful of so always make a backup and read before you go through. I was worried about the upgrade leading to unwanted changes, but the site was working great. I will note that they had a child theme based on it.

https://support.dream-theme.com/knowledgebase/procedure-to-update-the7-v3-and-v4-to-the7-v7/