Five methods for JavaScript to detect mobile browsers

Five methods for JavaScript to detect mobile browsers Original author: Ruan Yifeng Date: September 29, 2021 Sometimes, the front-end webpage needs to know whether the user is using a mobile browser or a desktop browser. Based on StackOverflow , this article sorts out five methods for JavaScript to detect mobile browsers. One, navigator.userAgent The easiest… Continue reading Five methods for JavaScript to detect mobile browsers

Clipboard operation Clipboard API tutorial

Clipboard operation Clipboard API tutorial Original author: Ruan Yifeng Date: January 20, 2021 1. Introduction The browser allows JavaScript scripts to read and write the clipboard, and automatically copy or paste content. In general, scripts should not modify the user’s clipboard, so as not to meet the user’s expectations. However, sometimes it can be convenient… Continue reading Clipboard operation Clipboard API tutorial

Fetch API tutorial

Fetch API tutorial Original author: Ruan Yifeng Date: December 28, 2020 fetch() It is an upgraded version of XMLHttpRequest, used to make HTTP requests in JavaScript scripts. The browser provides this object natively. This article introduces its usage in detail. 1. Basic usage fetch() The function is basically the same as XMLHttpRequest, but there are… Continue reading Fetch API tutorial

How Node.js handles ES6 modules

How Node.js handles ES6 modules Original author: Ruan Yifeng Date: August 20, 2020 Learning the JavaScript language, you will find that it has modules in two formats. One is the ES6 module, referred to as ESM; the other is the CommonJS module dedicated to Node.js, referred to as CJS. The two modules are not compatible.… Continue reading How Node.js handles ES6 modules

Getting started with Deno runtime: an alternative to Node.js

Getting started with Deno runtime: an alternative to Node.js Original author: Ruan Yifeng Date: January 26, 2020 In the past few days during the holidays, I have studied Deno . It is a replacement for Node.js. With it, Node.js may not be needed in the future. This article is a preliminary introduction to Deno, trying… Continue reading Getting started with Deno runtime: an alternative to Node.js

Getting started with React Hooks

Getting started with React Hooks Original author: Ruan Yifeng Date: September 1, 2019 React is the mainstream front-end framework. The v16.8 version introduces a new API called React Hooks , which overturns the previous usage. This API is the future of React and it is necessary to understand it in depth. This article talks about… Continue reading Getting started with React Hooks

Web Components Getting Started Example Tutorial

Web Components Getting Started Example Tutorial Original author: Ruan Yifeng Date: August 6, 2019 Components are the development direction of the front-end. Now popular React and Vue are both component frameworks. Since Google has mastered the Chrome browser, it has been promoting the browser’s native components, the Web Components API . Compared with third-party frameworks,… Continue reading Web Components Getting Started Example Tutorial

npx tutorial

npx tutorial Original author: Ruan Yifeng Date: February 9, 2019 npm Starting from version 5.2, the npx command has been added. It has many uses. This article introduces the main usage scenarios of this command. Node has its own npm module, so you can use the npx command directly. If it doesn’t work, install it… Continue reading npx tutorial