Home Web Front-end JS Tutorial Solve the problem that jquery1.9 does not support browser objects

Solve the problem that jquery1.9 does not support browser objects

Jul 08, 2017 am 10:07 AM
browser not support

The project has always used jquery1.9, which does not support browserobject. I searched on Baidu and found a solution. I would like to share it with you. Anyone has encountered this problem. Friends, don’t miss it

Recently, due to project needs, I have to use jquery’s cycle plug-in, but the project has always used jquery1.9, which does not support browser objects. I searched on Baidu and found a solution.

Just add the following code directly to the source code of the cycle plug-in:

The code is as follows:

(function(jQuery){ 
if(jQuery.browser) 
return
; 
jQuery.browser = {}; 
jQuery.browser.mozilla = false; 
jQuery.browser.webkit = false; 
jQuery.browser.opera = false; 
jQuery.browser.msie = false; 
var nAgt = navigator.userAgent; 
jQuery.browser.name = navigator.appName; 
jQuery.browser.fullVersion = ''+parse
Float
(navigator.appVersion); 
jQuery.browser.majorVersion = parseInt(navigator.appVersion,10); 
var nameOffset,verOffset,ix; 
// In Opera, the true version is after "Opera" or after "Version" 
if ((verOffset=nAgt.indexOf("Opera"))!=-1) { 
jQuery.browser.opera = true; 
jQuery.browser.name = "Opera"; 
jQuery.browser.fullVersion = nAgt.sub
string
(verOffset+6); 
if ((verOffset=nAgt.indexOf("Version"))!=-1) 
jQuery.browser.fullVersion = nAgt.
substr
ing(verOffset+8); 
} 
// In MSIE, the true version is after "MSIE" in userAgent 
else if ((verOffset=nAgt.indexOf("MSIE"))!=-1) { 
jQuery.browser.msie = true; 
jQuery.browser.name = "Microsoft Internet Explorer"; 
jQuery.browser.fullVersion = nAgt.substring(verOffset+5); 
} 
// In Chrome, the true version is after "Chrome" 
else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) { 
jQuery.browser.webkit = true; 
jQuery.browser.name = "Chrome"; 
jQuery.browser.fullVersion = nAgt.substring(verOffset+7); 
} 
// In Safari, the true version is after "Safari" or after "Version" 
else if ((verOffset=nAgt.indexOf("Safari"))!=-1) { 
jQuery.browser.webkit = true; 
jQuery.browser.name = "Safari"; 
jQuery.browser.fullVersion = nAgt.substring(verOffset+7); 
if ((verOffset=nAgt.indexOf("Version"))!=-1) 
jQuery.browser.fullVersion = nAgt.substring(verOffset+8); 
} 
// In Firefox, the true version is after "Firefox" 
else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) { 
jQuery.browser.mozilla = true; 
jQuery.browser.name = "Firefox"; 
jQuery.browser.fullVersion = nAgt.substring(verOffset+8); 
} 
// In most other browsers, "name/version" is at the end of userAgent 
else if ( (nameOffset=nAgt.lastIndexOf(&#39; &#39;)+1) < 
(verOffset=nAgt.lastIndexOf(&#39;/&#39;)) ) 
{ 
jQuery.browser.name = nAgt.substring(nameOffset,verOffset); 
jQuery.browser.fullVersion = nAgt.substring(verOffset+1); 
if (jQuery.browser.name.toLowerCase()==jQuery.browser.name.toUpperCase()) { 
jQuery.browser.name = navigator.appName; 
} 
} 
// trim the fullVersion string at semicolon/space if present 
if ((ix=jQuery.browser.fullVersion.indexOf(";"))!=-1) 
jQuery.browser.fullVersion=jQuery.browser.fullVersion.substring(0,ix); 
if ((ix=jQuery.browser.fullVersion.indexOf(" "))!=-1) 
jQuery.browser.fullVersion=jQuery.browser.fullVersion.substring(0,ix); 
jQuery.browser.majorVersion = parseInt(&#39;&#39;+jQuery.browser.fullVersion,10); 
if (isNaN(jQuery.browser.majorVersion)) { 
jQuery.browser.fullVersion = &#39;&#39;+parseFloat(navigator.appVersion); 
jQuery.browser.majorVersion = parseInt(navigator.appVersion,10); 
} 
jQuery.browser.version = jQuery.browser.majorVersion; 
})(jQuery);
Copy after login


This code is specially Solve the problem that the browser object is not supported.

The above is the detailed content of Solve the problem that jquery1.9 does not support browser objects. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

win11 client and server do not support commonly used ssl win11 client and server do not support commonly used ssl Dec 29, 2023 pm 02:09 PM

If neither the client nor the server implements SSL encryption technology, it is very easy for information to be stolen by intermediary attackers during the transmission process, thus causing serious risks to data security. For this reason, corresponding measures should be taken urgently to effectively ensure the security of sensitive data. You can refer to the following methods to operate. The win11 client and server do not support the commonly used SSL1. When upgrading and transforming the server system, you can give priority to upgrading and optimizing the server system, or supplementing the required necessary components to ensure that it can smoothly support the latest SSL protocol. 2. Deploy SSL certificates. You can purchase and deploy SSL certificates issued by prestigious certification centers, and install them in the server to achieve this function. 3. Enable SSL protocol

Is the Cat Recycle Bin not compatible with win11 operating system? Is the Cat Recycle Bin not compatible with win11 operating system? Dec 27, 2023 pm 12:54 PM

Recently, there is a very popular cat recycle bin on the Internet. It can change our recycle bin into a cat head. It is very cute. However, some friends found that their system cannot be used. So, does the cat recycle bin not support win11? In fact, it does. . Does the Cat Recycle Bin support win11? Answer: The Cat Recycle Bin supports win11. However, win11 does not support animation effects, only the icon can be changed. Win11 cat recycle bin setting tutorial: 1. First, right-click on the desktop and open "Personalization" 2. Then open the "Theme" setting on the right. 3. Then open "Desktop Icon Settings" under relevant settings 4. Then select "Recycle Bin (full)" and click "Change Icon" 5. After opening, click "Browse" 6. Find the cat reply we downloaded on the computer

0.0.0.0 Day exploit reveals 18-year-old security flaw in Chrome, Safari, and Firefox 0.0.0.0 Day exploit reveals 18-year-old security flaw in Chrome, Safari, and Firefox Aug 09, 2024 pm 12:42 PM

An 18-year-old vulnerability, known as the "0.0.0.0 Day" flaw, has been disclosed to allow malicious websites to bypass security protocols in major web browsers, including Google Chrome, Mozilla Firefox, and Apple Safari. The flaw primarily

How to solve '[Vue warn]: v-model is not supported on' error How to solve '[Vue warn]: v-model is not supported on' error Aug 25, 2023 pm 06:09 PM

How to solve the "[Vuewarn]:v-modelisnotsupportedon" error During development using Vue, sometimes we may encounter an error message: "Vuewarn:v-modelisnotsupportedon". This error message usually appears when using the v-model directive to bind elements, and it also reminds us that it may appear because we are trying to bind an unsupported element. So

What's the reason behind why Microsoft doesn't support php8? What's the reason behind why Microsoft doesn't support php8? Jan 26, 2024 am 10:31 AM

What is the reason behind Microsoft not supporting php8? With the release of PHP 8, many developers have expressed surprise and confusion that Microsoft does not support this latest version of PHP. As a technology giant, Microsoft has always supported and actively promoted the development of the developer ecosystem. Why did it choose not to support PHP8? First, we need to understand Microsoft's technology strategy. Microsoft is a company with multiple development teams and projects. Their developer tools and platforms such as Visual Studio and .NET

Analysis of the reasons why fixed positioning cannot be used in HTML Analysis of the reasons why fixed positioning cannot be used in HTML Dec 28, 2023 pm 02:17 PM

HTML is a markup language used to build web pages. It provides rich tags and attributes to achieve various web page layout effects. Among them, fixed positioning is a commonly used layout method, which allows elements to be displayed at a fixed position relative to the browser window or parent element, and is not affected by scrolling. However, not all HTML elements support fixed positioning. This article will analyze the reasons why fixed positioning is not supported in HTML and provide specific code examples. First, we need to understand the syntax of fixed positioning. In HTML, use CSS styles

Detailed instructions for computers that do not meet the Win11 system requirements Detailed instructions for computers that do not meet the Win11 system requirements Jan 02, 2024 pm 12:21 PM

Recently, the news about Microsoft win11 has been very popular. At the same time, many friends have appeared who don’t know whether their computers can support win11 system. In fact, whether or not they support win11 has little to do with the computer brand. It is only related to the hardware configuration. Let’s take a look at it together. Which computers do not support win11? Answer: As long as they do not meet the minimum configuration requirements, they are not supported. 1. We can view the computer configuration in the computer properties, find "This Computer" on the desktop, right-click and select "Properties" 2. View our computer hardware configuration in the "System" column. 3. Then check the following introduction to win11 configuration requirements and compare. 4. In addition, we can also directly detect whether our computer supports win1 by installing the win11 detection tool.

PHP output GD image to browser or file PHP output GD image to browser or file Mar 21, 2024 am 10:41 AM

This article will explain in detail how PHP outputs GD images to a browser or file. I think it is quite practical, so I share it with you as a reference. I hope you can gain something after reading this article. PHP outputs GD images to a browser or file Introduction The phpGD library provides powerful functions for processing images, allowing you to create, edit and output images. Images can be output to a browser or file for display or further processing. Output to Browser To output an image to a browser, use the following steps: Create an image resource: Use the imagecreate() function to create an image resource. Load image data: use imagepng(), imagejpeg() or imagegif()

See all articles