I have installed a duplicate of my site on a dev directory and have discover jQuery Carousel is no longer working.
I now get the error:
Uncaught TypeError: Cannot read property 'safari' of undefined
I don't understand this as I am testing on Chrome and Firefox.
Furthermore, this error is not occurring on the production version of the site - only the dev version.
I have updated jQuery, jQuery-UI and the version of jQuery Carousel as well as testing that all files are present but the problem persists.
Would anyone know what's going on and how to fix it?
My Carousel code is:
jQuery(document).ready(function($){
$('#mycarousel').jcarousel({
vertical: true,
scroll: 2
});
});
And if any wants a look a dev version of the site is here: http://www.dev.wakeup.com.au/
The problem might be that the plugin uses $.browser.
This has been deprecated and removed in jQuery version 1.9, as stated in their upgrade logs:
http://api.jquery.com/jquery.browser/
Description: Contains flags for the useragent, read from
navigator.userAgent. This property was removed in jQuery 1.9 and is
available only through the jQuery.migrate plugin. Please try to use
feature detection instead.
If this is the case, the plugin uses the (frowned-upon) browser sniffing techniques to achieve cross browser compatibility.
You might test the plugin with a version of jQuery before 1.9. If you need a newer version of jQuery, have a look at the plugin's page if there are any new versions available that fix this incompatibility with new jQuery versions.
Related
I'm using jquery git version (http://code.jquery.com/jquery-git.js) in my javascript and today when I opened the page, nothing works. It has worked for the last 3 years. Anyone else gets this? It looks like there has been updated at 2019-04-29T20:56Z. I know it unstable version, but is it I or anyone else also has this? When I use the 3.4 version, everything works fine. I'm using firefox and first error in console says TypeError: $.isArray is not a function[Learn More] and second
jQuery.Deferred exception: $(...).dialog is not a function #file:///C:/xxxx/xxx/xxx.js:20:19
mightThrow#http://code.jquery.com/jquery-git.js:3530:21
resolve/</process<#http://code.jquery.com/jquery-git.js:3598:12
undefined
Git version currently links to 4.0 pre, which is a large overhaul of jQuery to reflect updates to JavaScript. $.isArray was thus deprecated in 3.2, and consequently removed in 4.0, because JavaScript now has Array.isArray.
$.fn.dialog was never a part of jQuery that I know of (you might be thinking of jQuery UI?)
I have an Angular5 single-page app that works perfectly on Google Chrome, Firefox, Microsoft Edge and mobile browsers. However, with IE11, I get the errors:
ERROR TypeError: Object doesn't support property or method 'find'
and
ERROR TypeError: Object doesn't support property or method 'startswith'
Based on Angular docs, it's supposed to support IE11. I tried to apply fixes on the browser settings (as per Microsoft forums) like reset Advanced Settings in Internet Options and trying in compatibility mode, etc. But nothing on the browser configuration worked.
Is there any special configuration required on Angular side to make it work on IE11? How can I fix the errors mentioned above?
I'm not sure which code samples may be relevant, please let me know and I can provide. Thanks.
EDIT: More details on the accepted solution can be found in Angular - Browser Support. Specifically, enabling polyfills.
There should be a file called
polyfills.ts
In it, you can uncomment various polyfills for different browsers. Just read the commentblocks.
Those errors pop because IE doesn't implement those functions.
To resolve this, simply look for the functions on MDN's website.
For instance, here is the find method.
If you go to the bottom of the page, you will find a polyfill for this function (in the page I gave you, in french, it is Prothèse d'émulation).
Simply copy and paste your code into a Typescript file, and import that typescript file into your project.
I have created a sample index.html file and included the latest jquery (3.1.0) and jquery mobile (1.4.5).
On the loading page the error console outputed:
jquery.mobile-1.4.5.js:3337 Uncaught TypeError: Cannot read property 'concat' of undefined`
on this line:
mouseEventProps = $.event.props.concat( mouseHookProps ),
When I tried include jquery-1.11.2 there was no issue. Can any one tell me why?
Look this Documentation
jQuery mobile is locked to some versions of jQuery! You will find a text of
jQuery Mobile 1.3.0 supports versions of jQuery core 1.7.2 – 1.9.1 and
we’re actively testing the upcoming 2.0 version too. We will be
keeping in sync with their releases to let you take full advantage of
the new goodness.
UPDATE
jQuery mobile now works with 2.x versions too, though version 3 still returns the mentioned error.
Use latest version 1.5
( It is available at:
code.jquery.com):
http://code.jquery.com/mobile/1.5.0-rc1/jquery.mobile-1.5.0-rc1.min.js
I updated my jQuery from 1.3.2 to latest 2.1.0
Now I noticed I have this error on my page:
TypeError: Cannot read property 'safari' of undefined
And here is my code that has this:
if(p=='marginRight'&&$.browser.safari)
and
if($.browser.safari){this.buttons(false,false);
I read that from version 1.9 $.browser has been removed, can somebody please help, how can this be fixed? I googled and tried some things but didn't seem to find the right thing..
Thank you
you can detect browsers via native navigator object
if(navigator.userAgent.indexOf("Safari") > -1) {
// safari
}
The easiest way is to just include jquery-migrate. This patches in all the functions they removed.
Otherwise, you have to rewrite your code to avoid browser detection. Generally, feature detection is recommended over browser sniffing.
The jQuery.browser() method has been deprecated since jQuery 1.3 and
is removed in 1.9. If needed, it is available as part of the jQuery
Migrate plugin. We recommend using feature detection with a library
such as Modernizr.
Reference: http://jquery.com/upgrade-guide/1.9/#jquery-browser-removed
Since it has been removed your most simple option here is to use jquery migrate
I have a weird issue with firebug with my current javascript code
I have a web page with javascript and jQuery and I get this message:
use of getattributenodens is deprecated. use getattributens instead
I use jQuery 1.5.2 and Firefox 8, I get this error also on Windows 7 and XP. I tried mac also
I don't use getattributenodens in my code,
Who can fix this error? Thanks
Its just a warning, so developers can update their code with plenty of time.
You are a fair few versions behind in jQuery. If you upgrade to the current version (1.7.1), I think you will find this error message no longer exists.
Visit jQuery Website - http://www.jquery.com
Direct link to newest version — http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js