Share the encapsulated js judgment operating system with the browser code and encapsulate the js browser code
Abstract:The most important task for front-end development is compatibility, system compatibility, browser compatibility, and so on. Today, I will share a method for judging operating systems and browsers encapsulated in my project.
Operating System:
Copy
When we report the following error in the Google browser console, try the following methods;Error: Image from Origin ' file://' have been blocked from loading by cross-origin Resource sharing policy:invalid Response. Origin ' null ' is therefore not allowed access.The reason is: Google Chrome prohibits the cross-domain submission of Ajax1. Find the desktop browser, right click on the Mouse--click "shortcut"
of the object relative to the layout or the parent coordinate specified by the OffsetTop propertyEvent.clientx horizontal coordinates of relative documentsEvent.clienty vertical coordinates of relative documentsEvent.offsetx horizontal coordinates relative to the containerEvent.offsety the vertical coordinate of the relative containerDocument.documentElement.scrollTop The vertical scrolling valueEvent.clientx+document.documentelement.scrolltop horizontal coordinates of relative documents + amou
horizontal coordinates of relative documentsEvent.clienty vertical coordinates of relative documentsEvent.offsetx horizontal coordinates relative to the containerEvent.offsety the vertical coordinate of the relative containerDocument.documentElement.scrollTop The vertical scrolling valueEvent.clientx+document.documentelement.scrolltop horizontal coordinates of relative documents + amount of vertical scrollingImplementation code"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >Actual he
Detects WebGL and browser compatibility when using Three.js (detecting WebGL and browser compatibility with Three.js)The beautiful Life of the Sun Vulcan (http://blog.csdn.net/opengl_es)This article follows "Attribution-non-commercial use-consistent" authoring public agreementReprint Please keep this sentence: Sun Vulcan's Beautiful Life-this blog focuses on Agile development and mobile and IoT device resea
Habit is not the same, the operation will not be the same, many users are not accustomed to WINDOWS8 system automatically set for users of the default IE browser, want to specify their own common use of other Third-party browsers for the default to open, this how to operate it?
How the WINDOWS8 system sets the default browser:
1. First, we return to the desktop, and then click on the bottom left-hand corn
The first step: the first to install in the computer and open "Fast thunder" as shown in the following image
The second step: then in the open interface of the lower left, "Thunderbolt application" in the Open Interface click "Browser Support" as shown in the picture
Step three: Then pop up a ' browser diagnostics tool ' And now you can check it out, as shown
Fourth step: For exam
1. Log in to a network account
Click on the avatar to login to 360 account. When you log on to the 360 account, changes to your Favorites and browser configuration are automatically backed up to 360 accounts. Log on to the 360 account at any time to automatically synchronize the above content to the browser.
2. Replace Avatar
You can choose your favorite avatar from the Avatar menu to decorate your
For more than 10 years, a nightmare lingering in the minds of m$ executives has been that one day, perhaps the browser will replace Windows,windows itself will no longer matter. No one really needs windows anymore, they just need a browser.
When Netscape's browser first supported Java applets more than 10 years ago, there were prophets who said a new era was abo
Win8 uses the IE browser to open the QQ space by default. You can use the following settings to change the new computer, i5 processor, 8 GB memory, and 1 TB hard disk of the browser two days ago. So I plan to change the system to win8 for fun, because I have never used win8 before. When I see some advertisements promoting win8, I feel like the picture is good and I want to try it out, the computer must be c
Browser Page Fallback Event Browser leaves page or closes tab prompt Window.onbeforeunload = function () {return "is sure to leave?";//Leave the page tip} or $ (window). Unload (function () {alert (" Goodbye! ");}); Browser Enter page event or page load Complete event Window.onload = function () {} or $ (function () {}) Note: The former can only be executed once
Autoprefixer parse the CSS file and add the browser prefix to the CSS rules, use the data of can I uses to determine which prefixes are needed.All you need to do is add it to your resource builder (for example, Grunt) and completely forget the CSS prefix. Although it is normal to write your CSS in accordance with the latest specifications, you do not need a browser prefix. Like this: a{transition: Transform
Js gets browser information and page information, and js gets browser pages
1. js gets browser information, including determining whether the browser is mobile or not, browser information, and android version
2. js obtains the url, domain, and title of the page.
Function br
honest, there's a problem with full screens, which can easily lead to deception, such ashttp://feross.org/html5-fullscreen-api-attack/, where there is a good demo, to cheat, such as a link is written by http://www.bankofamerica.com, People thought it was Bank of America, a little in, because using the full-screen API, it would deceive people
123456789101112131415161718
$(‘html‘).on(‘click keypress‘, ‘a‘, function(event) { // 不响应真正的A HREF点击事件 event.preventDefault(); event.stopPr
Many web sites through user-agent to determine the type of browser, if it is 3G mobile phone, display mobile page content, if it is a normal browser, display ordinary Web content. Google Chrome Browser, can be easily used as a 3G phone simulator. In the Windows "start"--> "Run" Enter the following command, launch Google Brows
Find a good code for using JavaScript to judge browsers and browser versions from the Web, and record this here:
Encapsulate the above code as a method that returns the Sys object, which encapsulates the browser's type and version information as follows:
function Getbrowserinfo () {
var Sys = {};
var ua = Navigator.userAgent.toLowerCase ();
var re =/(msie|firefox|chrome|opera|version). *? ([\d.] +)/;
var m = Ua.match (re
This article mainly introduces how to disable the browser input box and automatically complete compatibility with mainstream browsers such as IE, FF, and Chrome. For more information, see. I hope it will help you to implement the input history function in firefox and ie browsers, which can simplify the input troubles. However, sometimes the pop-up drop-down box will block the content displayed on the page, in some cases, you do not need to record the
Header ( #039; Content-Encoding: gzip #039;); header ( quot; Vary: Accept-Encoding quot;); but the browser prompts an error. How can this problem be solved? Thanks for setting the header ('content-Encoding: gzip ');
Header ("Vary: Accept-Encoding ");
But the browser prompts an error. How can this problem be solved? Thank you.
Reply content:
Set the header ('content-Encoding: gzip ');Header ("Vary: A
Open the browser: Tools-Internet Options-
Program-Manage Add-on (M )-
Disable all the following three items:
1-(unverified)
2-browser help program object
3-The final file name ends with. dll, closes the browser, and re-opens the file (the add-on must comply with the preceding three items at the same time)
Solution 1: directly disable the IE ad
Cross-browser event handlers and cross-browser events
Var eventUtil = {// defines an object addEventHandler: function (element, type, handler) {// handler is the trigger operation, that is, function. When passing parameters, function is not enclosed in parentheses. If (element. addEventListener) {// supports dom2-level elements. addEventListener (type, handler, false);} else if (element. attachEvent) {// su
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.