Browser is undefined error

I am using msdropdown image combo box to create dropdown select options. when I run this code locally on my PC, everything works great. But when I run it on GoDaddy servers, the msdropdown becomes

I am using msdropdown image combo box to create dropdown select options.
when I run this code locally on my PC, everything works great. But when I run it on GoDaddy servers, the msdropdown becomes disabled.

It doesn’t work on any browsers. Firebug displays the error as:

TypeError: $.browser is undefined

 echo <<<_START
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
 <title>profile</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="HAPedit 3.1">
<link rel="stylesheet" href="profile.css" type="text/css">
<link rel="stylesheet" type="text/css" href="dd.css" />
<link rel="stylesheet" href="javascript/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<script type="text/javascript" src="jQuery.js"></script>
<script src="javascript/jquery-ui.js"></script>
<script type="text/javascript" src="javascript/drop.js"></script>
<script src="jquery.dd.min.js"></script>
<script type="text/javascript" src="jquery.blockUI3.js"></script>
<script type="text/javascript" src="javascript/req.js"></script>
<link rel="stylesheet" href="css/body.css" />
<script>
$(function() {
$( "#datepicker" ).datepicker({dateFormat: 'dd-mm-yy', minDate: 0, maxDate: "+0M +5D"
 });
});
</script>
<script type="text/javascript">
    <!--
        function otherSelect() {
            var other = document.getElementById("otherBox");
            if    (document.getElementById("form3").place.options[document.getElementById("form3").place.selectedIndex].value == "other") {
                other.style.visibility = "visible";
            }
            else {
                other.style.visibility = "hidden";
            }
        }
    //-->
</script>
</head>

<body id="body">

 <div id="container">
<div class="header">
<a href="profile.php" class="logo">
    <img title="Title" alt="Alter" src="images/logo.png" border="0" height="60px"  width="200px">
</a>
<a style="text-decoration:none; margin-top:15px; font-family:Bookman Old Style;  font-size:12px; color:#FFFFFF; font-weight:bold;" href="logout.php?id='$session_id'"  class="req">
Logout
</a>
<a href="notification.php?email='$encrypted_string'" class="req1">
<img border="0" title="Notifications" alt="Notifications" src="images/notification.png" height="60px" width="60px"><div class="text1">$numbr</div>
</a>
<a href="request.php?email='$encrypted_string'" class="req2">
<img border="0" title="requests" alt="Requests" src="images/request.png" height="60px" width="60px"><div class="text">$req</div>
</a>
</div>

<div id="navigation">
<div id="picture"><img src="$img">
<h1 id="display" style="margin-left:30px;">$name</h1><hr>
<table style="background-color:#81F781;font-family:Chaparral Pro,corbel; font-   size:17px; color:#1C1C1C; width:100%;" border="1" cellpadding="25">
<tr><th>Requests($n)</th></tr></table>
</div>
</div></div>
<div style="margin-top: 90px;" id="conte">

_START;

 echo <<<_START
 </div>
 <div id="accept" style="display:none">
<form method="post" id="form3" action="cnfrm.php">
<br><table border="0" style="width:100%;" cellspacing="4" cellpadding="4"><tr>    <td  style="font-family:Chaparral Pro,corbel; font-size:17px; color:#1C1C1C;">Meeting Date:   <input type="text" id="datepicker" name="date"/></td>
<td style="font-family:Chaparral Pro,corbel; font-size:17px; color:#1C1C1C;">@ about<input  type="text" id="time" size="3">AM<input type="radio" name="time2" id="time2" value="am"> |   PM<input type="radio" name="time2" id="time2" value="pm"></td></tr>
_START;

echo <<<H
<tr><td valign="top" rowspan="2">
<select id="place" name="place" style="width:300px;" onchange="otherSelect()">
    <option value="" data-description="Choose your meeting place"  selected="selected">Meet me @</option>
    <option value="LC" data-image="image/msdropdown/icons/meet.png" data-description="Limbdi Corner">L.C</option>
    <option value="VT" data-image="image/msdropdown/icons/meet.png" data-description="Vishwanath temple">V.T</option>
    <option value="H.G" data-image="image/msdropdown/icons/meet.png" data-description="Hyderabaad Gate">H.G</option>
    <option value="D.G Corner" data-image="image/msdropdown/icons/meet.png" data-description="Dhanrajgiri Corner">D.G corner</option>
    <option value="Library" data-image="image/msdropdown/icons/meet.png" data-description="IIT Library">Library</option>
    <option value="other" data-image="image/msdropdown/icons/meet.png" data-description="Add your own...">Other place</option>
</select> </td></tr>
H;

This problem has been solved:msdropdown update and download the latest files.

Stephen Ostermiller's user avatar

asked Feb 10, 2013 at 13:47

user1972934's user avatar

4

just put the $.browser code in your js

var matched, browser;

jQuery.uaMatch = function( ua ) {
    ua = ua.toLowerCase();

    var match = /(chrome)[ /]([w.]+)/.exec( ua ) ||
        /(webkit)[ /]([w.]+)/.exec( ua ) ||
        /(opera)(?:.*version|)[ /]([w.]+)/.exec( ua ) ||
        /(msie) ([w.]+)/.exec( ua ) ||
        ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([w.]+)|)/.exec( ua ) ||
        [];

    return {
        browser: match[ 1 ] || "",
        version: match[ 2 ] || "0"
    };
};

matched = jQuery.uaMatch( navigator.userAgent );
browser = {};

if ( matched.browser ) {
    browser[ matched.browser ] = true;
    browser.version = matched.version;
}

// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
    browser.webkit = true;
} else if ( browser.webkit ) {
    browser.safari = true;
}

jQuery.browser = browser;

answered Jul 5, 2013 at 18:39

daniel.moura's user avatar

daniel.mouradaniel.moura

1,6171 gold badge11 silver badges4 bronze badges

5

$.browser has been removed from JQuery 1.9. You can to use Modernizr project instead

http://jquery.com/upgrade-guide/1.9/#jquery-browser-removed

UPDATE TO SUPPORT IE 10 AND IE 11 (TRIDENT version)

To complete the @daniel.moura answer, here is a version which support IE 11 and +

var matched, browser;

jQuery.uaMatch = function( ua ) {
    ua = ua.toLowerCase();

    var match = /(chrome)[ /]([w.]+)/.exec( ua ) ||
        /(webkit)[ /]([w.]+)/.exec( ua ) ||
        /(opera)(?:.*version|)[ /]([w.]+)/.exec( ua ) ||
        /(msie)[s?]([w.]+)/.exec( ua ) ||       
        /(trident)(?:.*? rv:([w.]+)|)/.exec( ua ) ||
        ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([w.]+)|)/.exec( ua ) ||
        [];

    return {
        browser: match[ 1 ] || "",
        version: match[ 2 ] || "0"
    };
};

matched = jQuery.uaMatch( navigator.userAgent );
//IE 11+ fix (Trident) 
matched.browser = matched.browser == 'trident' ? 'msie' : matched.browser;
browser = {};

if ( matched.browser ) {
    browser[ matched.browser ] = true;
    browser.version = matched.version;
}

// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
    browser.webkit = true;
} else if ( browser.webkit ) {
    browser.safari = true;
}

jQuery.browser = browser;
// log removed - adds an extra dependency
//log(jQuery.browser)

user1794212's user avatar

answered Feb 10, 2013 at 13:51

sdespont's user avatar

sdespontsdespont

13.8k9 gold badges55 silver badges96 bronze badges

4

I placed the following html in my code and this cleared up the $.browser error

<script src="http://code.jquery.com/jquery-migrate-1.0.0.js"></script>

Hope this helps u

answered Mar 29, 2014 at 4:54

Paul Preibisch's user avatar

Paul PreibischPaul Preibisch

3,9792 gold badges26 silver badges31 bronze badges

1

Replace your jquery files with followings :

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>

answered Aug 19, 2015 at 15:33

ikuchris's user avatar

ikuchrisikuchris

1,1321 gold badge15 silver badges32 bronze badges

1

i did solved it using jQuery migrate link specified below:

<script src="http://code.jquery.com/jquery-migrate-1.0.0.js"></script>

Ravi Dhoriya ツ's user avatar

answered Jul 15, 2014 at 5:27

Raja Ram T's user avatar

Raja Ram TRaja Ram T

8448 silver badges8 bronze badges

0

Somewhere the code—either your code or a jQuery plugin—is calling $.browser to get the current browser type.

However, early has year the $.browser function was deprecated. Since then some bugs have been filed against it but because it is deprecated, the jQuery team has decided not to fix them. I’ve decided not to rely on the function at all.

I don’t see any references to $.browser in your code, so the problem probably lies in one of your plugins. To find it, look at the source code for each plugin that you’ve referenced with a <script> tag.

As for how to fix it: well, it depends on the context. E.g., maybe there’s an updated version of the problematic plugin. Or perhaps you can use another plugin that does something similar but doesn’t depend on $.browser.

answered Feb 10, 2013 at 13:55

Brian Morearty's user avatar

In WordPress 8.5.1, I installed this plugin «Enable jQuery Migrate Helper».

And it worked without any problem.

answered Oct 7, 2021 at 16:51

Francisco Campos's user avatar

1

Since this thread is the first entry most of the people stumble upon. I would like to share my fix as well.
You can enqueue your script as following in functions.php file.

add_action( 'wp_enqueue_scripts', 'patch_jquery_migrate' );
function patch_jquery_migrate() {
    wp_deregister_script('jquery-migrate');
    wp_register_script('jquery-migrate', ("http://code.jquery.com/jquery-migrate-1.0.0.js"), false, null);
    wp_enqueue_script( 'jquery-migrate' );
}

answered May 13, 2022 at 5:40

zawhtut's user avatar

zawhtutzawhtut

8,2535 gold badges50 silver badges76 bronze badges

$.browser function has been deprecated from the latest jQuery version. It had the flags $.browser.webkit, $.browser.safari, $.browser.opera, $.browser.msie and $.browser.mozilla to detect respective browsers in previous versions. But now, if your site has code with these flags and your theme has the latest version of jQuery, then it will throw an error message sayings “undefined”. But do not worry, you can fix it.

From WordPress version 5.5, “jquery-migrate” library has been removed from WordPress core. Hence, you will get an error if your theme or any other plugins are trying to access any jQuery features that are deprecated. You can also install a plugin called Enable jQuery Migrate Helper, to include the jquery-migrate library in the latest version of WordPress.

How to fix $.browser error:

Normally this issue occurs in an older version of themes that are not updated. You have to enqueue the jquery-migrate library in your theme to fix the issue.

if ( !function_exists( 'wptips_add_juery_migrate' ) ) {
  /**
   * Add jQuery Migrate script in front end.
   *
   */
  function wptips_add_juery_migrate() {
    wp_enqueue_script( 'jquery-migrate' );
  }
}
add_action( 'wp_head', 'wptips_add_juery_migrate' );

You can check your theme for jquery script enqueue or any other script with jquery as a dependency and make sure that you add an additional dependency of jquery-migrate to fix the issue.

How to fix errors in the admin section only :

// add jquery migrate only to the admin section
function wptips_add_jquery_migrate() {  
        wp_enqueue_script('jquery-migrate');  
}  
add_action('admin_enqueue_scripts', 'wptips_add_jquery_migrate'); 

Note: You have to add the code in the functions.php file of your active theme for it to work.

If you still have any questions, please ask me in the comment section. I will be glad to help you out.

  • Tags JavaScript error, jQuery, jquery-migrate, Web browser, wp_enqueue_script
  • Remove From My Forums
  • Question

  • I have searched all over the internet looking for the answer to this issue.

    Using Internet Explorer 7 when we visit a page in our company Intranet that is handled by Sharepoint we receive a browser error stating that «‘browseris’ is undefined» on Line 4 Column 1 of our default.aspx.

    However, when viewing the source code of the site there is no call for a browseris variable in any scripting.

    We are really looking for an answer as to where this comes from and how can it be gotten rid of?

Answers

  •  Actually adding the call for INIT.js and CORE.js, as described above, manually into the <head> tag of the master page has fixed this problem.

    The problem is that apparently there are at times javascripts that require INIT.js and CORE.js that are being added before these are added. Reason is unknown but most likely in how the page is built.

    I now manually add the <script> tags where I want them in the HTML.

    • Marked as answer by

      Monday, March 9, 2009 11:20 AM

At this site I have an error using the parent theme’s jquery.PrettyPhoto.js This causes tabs not to load well nor gallery to work well it seems. The error states

TypeError: $.browser is undefined
http://www.domain.com/wp-content/themes/decondo/lib/scripts/pretty/jquery.prettyPhoto.js?ver=2.5
Line 59

I enqueued jQuery Migrate — v1.0.0 — 2013-01-14 with following code (whole function added): http://pastebin.com/EC3XrTiq

to the parent theme’s function.php as I thought it would be related to an outdated jQuery function — see https://stackoverflow.com/questions/14524289/browser-is-undefined-error -.

I found another thread at SE that suggested adding the $.browser function mentioning this function was no longer used since 1.3. The version loaded on those pages is 1.8.3 so this could be the issue then. Odd I did not have the issue earlier, but anyways.

I realized that jQuery migrate was not being loaded checking these pages in Firebug. I is located here for sure though and would say the path is correct.

Thanks to to some more research and a check in safari using the inspector I did realise the jQuery migrate scripts is already loaded by WordPress.

Now the issue remains why the site’s gallery (issues in Safari with layout), menu (dropdown broken in Firefox) and tabs (not loaded in Firefox) are not loading well and if the deprecated browser function is causing this or not.

Понравилась статья? Поделить с друзьями:
  • Browser exe ошибка приложения 0xc0000005
  • Browser elf dll ошибка
  • Browser elf dll как исправить
  • Browser conflicts как исправить
  • Browser assistant exe ошибка приложения