0

Probably after jQuery library update got this issue, also checked other similar issues but didn't found anything related with var problems.

Error: Uncaught TypeError: f is undefined

Code:

var j,
        k = $.event.special,
        c = "location",
        d = "hashchange",
        l = "href",
        f = $.browser,
        g = document.documentMode,
        h = f.msie && (g === b || g < 8),
        e = "on" + d in i && !h;

Problem is in h variable, also whole code of the function is:

(function ($, i, b) {
    var j,
        k = $.event.special,
        c = "location",
        d = "hashchange",
        l = "href",
        f = $.browser,
        g = document.documentMode,
        h = f.msie && (g === b || g < 8),
        e = "on" + d in i && !h;
    function a(m) {
        m = m || i[c][l];
        return m.replace(/^[^#]*#?(.*)$/, "$1");
    }
    $[d + "Delay"] = 100;
    k[d] = $.extend(k[d], {
        setup: function () {
            if (e) {
                return false;
            }
            $(j.start);
        },
        teardown: function () {
            if (e) {
                return false;
            }
            $(j.stop);
        },
    });
    j = (function () {
        var m = {},
            r,
            n,
            o,
            q;
        function p() {
            o = q = function (s) {
                return s;
            };
            if (h) {
                n = $('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;
                q = function () {
                    return a(n.document[c][l]);
                };
                o = function (u, s) {
                    if (u !== s) {
                        var t = n.document;
                        t.open().close();
                        t[c].hash = "#" + u;
                    }
                };
                o(a());
            }
        }
        m.start = function () {
            if (r) {
                return;
            }
            var t = a();
            o || p();
            (function s() {
                var v = a(),
                    u = q(t);
                if (v !== t) {
                    o((t = v), u);
                    $(i).trigger(d);
                } else {
                    if (u !== t) {
                        i[c][l] = i[c][l].replace(/#.*/, "") + "#" + u;
                    }
                }
                r = setTimeout(s, $[d + "Delay"]);
            })();
        };
        m.stop = function () {
            if (!n) {
                r && clearTimeout(r);
                r = 0;
            }
        };
        return m;
    })();
})(jQuery, this);

Other issues solutions was for not proper closing of the function, but this one - and in variables section little bit confusing me. Thanks in advance for any ideas!

wassaabii
  • 71
  • 7
  • 1
    Which version of jQuery you're using? Because as far as I know, **$.browser** was removed from >= 1.9 versions. And available only through the jQuery.migrate plugin. – Nagy Szabolcs Jul 28 '21 at 09:21
  • @NagySzabolcs console says version 3.3.2, what definition should be to replace this? Or it's depreciated and I should remove it at all? – wassaabii Jul 28 '21 at 09:25

1 Answers1

0

Thanks for reading, solved it by other answer : in this link

Used this code for jQuery migrate, and issue gone.

wassaabii
  • 71
  • 7