Skip to content

Commit

Permalink
docs: update javascript bom document
Browse files Browse the repository at this point in the history
  • Loading branch information
feng-zhang0712 committed Jan 9, 2025
1 parent aa009ac commit dddad3a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
10 changes: 5 additions & 5 deletions _posts/javascript/javascript-tutorial/2024-10-18-bom.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ if (window.parent !== window.self) {

`window.navigator` 属性指向一个包含浏览器和系统信息的 Navigator 对象。脚本通过这个属性了解用户的环境信息。

### 1. Navigator 对象的属性
### 3.1 Navigator 对象的属性

- `navigator.userAgent` 属性返回浏览器的 User Agent 字符串,表示用户**设备信息**,包含了浏览器的厂商、版本、操作系统等信息。

Expand All @@ -562,12 +562,12 @@ if (window.parent !== window.self) {
- `Navigator.geolocation` 属性返回一个 Geolocation 对象,包含用户地理位置的信息。注意,该 API 只有在 HTTPS 协议下可用。
- `Navigator.cookieEnabled` 属性返回一个布尔值,表示浏览器的 Cookie 功能是否打开。注意,这个属性反映的是浏览器总的特性,与是否储存某个具体的网站的 Cookie 无关。

### 2. Navigator 对象的方法
### 3.2 Navigator 对象的方法

- `Navigator.javaEnabled()` 布尔值,表示浏览器是否能运行 Java Applet 小程序。注意,该方法目前[已弃用](https://developer.mozilla.org/zh-CN/docs/Web/API/Navigator/javaEnabled)
- `Navigator.sendBeacon(url, data)` 方法用于向服务器异步发送数据。

### 3. Screen 对象
### 3.3 Screen 对象

Screen 对象表示当前窗口所在的屏幕,提供显示设备的信息。`window.screen` 属性指向这个对象。

Expand Down Expand Up @@ -1505,11 +1505,11 @@ document.location.href = 'http://www.example.com';
- `Location.reload(force)` 方法使得浏览器重新加载当前网址,相当于按下浏览器的刷新按钮。它接受一个布尔值作为参数。如果参数为 `true`,浏览器将向服务器重新请求这个网页,并且重新加载后,网页将滚动到头部(即 `scrollTop === 0`)。如果参数是 `false` 或为空,浏览器将从本地缓存重新加载该网页,并且重新加载后,网页的视口位置是重新加载前的位置。
- `Location.toString()` 方法返回整个 URL 字符串,相当于读取 `Location.href` 属性。
### 2. URL 的编码和解码
### 10.2 URL 的编码和解码
网页的 URL 只能包含合法的字符。合法字符分成两类。
- **元字符**斜杠(`/`),冒号(`:`),at(`@`),问号(`?`),等号(`=`),`&`,井号(`#`),分号(`;`),逗号(`,`),加号(`+`),美元符号(`$`
- **元字符**冒号(`:`),斜杠(`/`),at(`@`),问号(`?`),等号(`=`),`&`,井号(`#`),分号(`;`),逗号(`,`),加号(`+`),美元符号(`$`
- **语义字符**`a-z``A-Z``0-9`,连词号(`-`),下划线(`_`),点(`.`),感叹号(`!`),波浪线(`~`),星号(`*`),单引号(`'`),圆括号(`()`
除了以上字符,其他字符出现在 URL 之中都必须转义,规则是根据操作系统的默认编码,将每个字节转为百分号(`%`)加上两个大写的十六进制字母。
Expand Down
22 changes: 10 additions & 12 deletions _posts/question-collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
- [点击回到顶部](https://fe.ecool.fun/topic/82f034bf-f411-4569-b442-af7b6c229eb9?orderBy=default&order=desc&tagId=12&exerciseCate=0&ignoreMaster=1&difficulty=)
- [SEO 的原理](https://fe.ecool.fun/topic/255b920d-ba6d-4e6a-85ac-58c78d2e0773?orderBy=default&order=desc&tagId=12&exerciseCate=0&ignoreMaster=1&difficulty=)
- [SPA 应用的 SEO](https://fe.ecool.fun/topic/c14803df-f552-4a23-b50d-fd8e3f77f17e?orderBy=default&order=desc&tagId=12&exerciseCate=0&ignoreMaster=1&difficulty=)
- [前端跨页面通信方法](https://fe.ecool.fun/topic/16cd86d3-cdc5-4c8c-946b-19f72408525f?orderBy=default&order=desc&tagId=12&exerciseCate=0&ignoreMaster=1&difficulty=)
- [浏览器标签页间的通信](https://fe.ecool.fun/topic/833fba72-1614-4502-adc3-1f5593ae6560?orderBy=default&order=desc&tagId=12&exerciseCate=0&ignoreMaster=1&difficulty=)
- [DNS 预解析及其实现](https://fe.ecool.fun/topic/d76e76c3-7400-4c6e-958a-b5f00916d47d?orderBy=default&order=desc&tagId=12&exerciseCate=0&ignoreMaster=1&difficulty=)
- [HTML5 中的 drag 相关的 API](https://fe.ecool.fun/topic/969cddcd-b1ac-4285-86f6-ae0a8eaf828a?orderBy=default&order=desc&tagId=12&exerciseCate=0&ignoreMaster=1&difficulty=)
- [浏览器乱码的原因及解决方式](https://fe.ecool.fun/topic/8e135d77-c081-4419-b0b3-2e43461d5b55?orderBy=default&order=desc&tagId=12&exerciseCate=0&ignoreMaster=1&difficulty=)
Expand Down Expand Up @@ -199,17 +197,19 @@
- [x] [requestAnimationFrame](https://fe.ecool.fun/topic/828350f9-b3d1-4593-8306-e5bc567b5c28?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [ToPrimitive](https://fe.ecool.fun/topic/0e76f42e-3479-4aea-b00b-2388fd5ed8de?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [版本号排序](https://fe.ecool.fun/topic/dd99ac0b-0442-4b0e-aead-fe50315218f7?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [判断某个字符串长度(要求支持表情)](https://fe.ecool.fun/topic/53de0582-783d-490b-b7ca-7a20e9d13cb8?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [x] [判断某个字符串长度(要求支持表情)](https://fe.ecool.fun/topic/53de0582-783d-490b-b7ca-7a20e9d13cb8?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [对模块化方案的理解,比如 CommonJS、AMD、CMD、ES Module](https://fe.ecool.fun/topic/f5f2f81e-c0c8-409e-ba00-3f3428ae535b?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [说说你对 JS 的模块化方案的了解](https://fe.ecool.fun/topic/8ecafda7-0ae6-40bd-b8c6-385d02fa7165?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [一个滚动公告组件,如何在鼠标滑入时停止播放,在鼠标离开时继续等待滑入时的剩余等待时间后播放?](https://fe.ecool.fun/topic/d281c552-c5d1-4d42-b2fa-0e0774884bbf?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [使用 Math.random() 计算中奖概率会有什么问题](https://fe.ecool.fun/topic/96c01fd6-3a42-497e-aca3-4232d08b8e6b?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [x] [使用 Math.random() 计算中奖概率有什么问题](https://fe.ecool.fun/topic/96c01fd6-3a42-497e-aca3-4232d08b8e6b?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [相比于 npm 和 yarn,pnpm 的优势是什么?](https://fe.ecool.fun/topic/b6d72acf-0360-4fc1-8835-6a6f8a3a4025?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [导致页面加载白屏时间长的原因有哪些,怎么进行优化?](https://fe.ecool.fun/topic/841bfe02-d07d-45db-9e65-b9c250595d80?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [怎么使用 js 动态生成海报](https://fe.ecool.fun/topic/495d46ca-f2ed-4b5c-a34a-1fa80709f0f5?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [怎么把十进制的 0.2 转换成二进制](https://fe.ecool.fun/topic/0ea76a47-8e0f-4d79-81a6-7ca371b1ea8c?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [导致页面加载白屏时间长的原因及优化](https://fe.ecool.fun/topic/841bfe02-d07d-45db-9e65-b9c250595d80?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [使用 js 动态生成海报](https://fe.ecool.fun/topic/495d46ca-f2ed-4b5c-a34a-1fa80709f0f5?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [x] [把十进制的 0.2 转换成二进制](https://fe.ecool.fun/topic/0ea76a47-8e0f-4d79-81a6-7ca371b1ea8c?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [实现以下转换,合并连续的数字](https://fe.ecool.fun/topic/b41d5c3e-04c4-4873-867c-62ebf28ce369?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [前端跨页面通信,你知道哪些方法?](https://fe.ecool.fun/topic/16cd86d3-cdc5-4c8c-946b-19f72408525f?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [x] [前端跨页面通信方法](https://fe.ecool.fun/topic/16cd86d3-cdc5-4c8c-946b-19f72408525f?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [x] [浏览器内多个标签页之间的通信](https://fe.ecool.fun/topic/833fba72-1614-4502-adc3-1f5593ae6560?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [x] [本地实现一个聊天室,多个 tab 页相互通信,不能用 websocket](https://fe.ecool.fun/topic/7053c84f-1316-43f2-a2ba-23fb00318220?orderBy=default&order=desc&tagId=10&exerciseCate=2&ignoreMaster=1&difficulty=)
- [如何顺序执行 10 个异步任务?](https://fe.ecool.fun/topic/f72409bc-ca63-4891-8443-c68f48ff37e9?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [如何获取页面的滚动距离值?](https://fe.ecool.fun/topic/bae25a07-be25-4857-ae96-9f9e1130286e?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [用js实现二叉树的定义和基本操作](https://fe.ecool.fun/topic/68c29b20-6b2f-4efa-b6f7-772cc7958084?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
Expand Down Expand Up @@ -252,7 +252,7 @@
- [x] [检测浏览器版本](https://fe.ecool.fun/topic/7ff627a9-0948-4352-9b70-69aad59fe2ec?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [x] [点击穿透及怎么解决](https://fe.ecool.fun/topic/eb451be3-dc88-481c-b8a8-da6c8d278e95?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [x] [移动端的点击事件及怎么解决](https://fe.ecool.fun/topic/b43082e8-2312-4594-ac1c-4f0d2d5da81c?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [判断页面是通过 PC 端还是移动端访问](https://fe.ecool.fun/topic/664e2875-26fa-45b0-89cd-9cb961ec8046?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [x] [判断页面是通过 PC 端还是移动端访问](https://fe.ecool.fun/topic/664e2875-26fa-45b0-89cd-9cb961ec8046?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [flexible.js 实现移动端适配的原理是什么?](https://fe.ecool.fun/topic/3c003aad-68a0-4abf-8fbc-62e37b4f3b10?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [setTimeout 运行机制](https://fe.ecool.fun/topic/cdeec2cc-5772-4c63-b7f0-34f864ea886d?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [js 中的倒计时,怎么实现纠正偏差?](https://fe.ecool.fun/topic/7b48e19d-6596-4853-875f-067f9bb048a8?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
Expand All @@ -271,7 +271,7 @@
- [谈谈你对浏览器中进程和线程的理解](https://fe.ecool.fun/topic/fe257d38-7fa5-4062-bdc5-e11525b984a4?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [尾调用优化、尾递归](https://fe.ecool.fun/topic/246fb719-7819-481e-943d-480a219e29b4?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [严格模式](https://fe.ecool.fun/topic/54538af6-dc63-4f34-a9c9-0d76482e5558?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [为什么部分请求中,参数需要使用 encodeURIComponent 进行转码](https://fe.ecool.fun/topic/ea7dbe32-726d-4d21-a9bc-3df77e1ec853?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [x] [为什么请求参数需要使用 encodeURIComponent 进行转码](https://fe.ecool.fun/topic/ea7dbe32-726d-4d21-a9bc-3df77e1ec853?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [变量提升](https://fe.ecool.fun/topic/cf3a9965-7761-4d5e-8b0a-cbde804517b8?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [WebSocket 中的心跳是为了解决什么问题?](https://fe.ecool.fun/topic/14ad497b-56ee-461b-8c82-110f4d1c04b0?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [WebSocket](https://fe.ecool.fun/topic/4449a399-c20d-49e7-aac6-05236ee28662?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
Expand All @@ -288,7 +288,6 @@
- [微前端可以解决什么问题?](https://fe.ecool.fun/topic/d3411be6-a0be-4901-8f37-f418af1c0475?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [微前端](https://fe.ecool.fun/topic/0c0db5d1-e09a-4699-911a-3cfa4f4bd765?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [webSocket 如何兼容低浏览器](https://fe.ecool.fun/topic/9f860d42-8504-4562-8b9a-4a415ba5782a?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [浏览器内多个标签页之间的通信](https://fe.ecool.fun/topic/833fba72-1614-4502-adc3-1f5593ae6560?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [说说你对 SPA 的理解](https://fe.ecool.fun/topic/73413861-0e94-4d71-bff3-65e8515ddc17?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [web 常见的攻击方式有哪些,以及如何进行防御?](https://fe.ecool.fun/topic/947278fd-7485-4e8c-a704-83d48280e05a?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [实现上拉加载,下拉刷?](https://fe.ecool.fun/topic/0567a810-b795-4c41-84e2-cba8ae4b97ac?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
Expand Down Expand Up @@ -329,7 +328,6 @@
- [如果要设计一个转盘组件,你会考虑哪些方面?有哪些是需要和业务方确认的技术细节?另外,如何从前端的角度进行防刷?](https://fe.ecool.fun/topic/5a7e6ba9-31c0-45c2-8997-1ce10f2bf330?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [实现一个将数字转换成汉语的方法,输入为不超过 10000 亿的数字](https://fe.ecool.fun/topic/903ad6ce-2c81-4d82-a356-536e4629cfa3?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [实现一个数字转中文的方法](https://fe.ecool.fun/topic/38114327-a110-4a75-8745-534924338657?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [x] [在本地实现一个聊天室,多个 tab 页相互通信,不能用 websocket](https://fe.ecool.fun/topic/7053c84f-1316-43f2-a2ba-23fb00318220?orderBy=default&order=desc&tagId=10&exerciseCate=2&ignoreMaster=1&difficulty=)
- [x] [使用 js 计算一个 html 页面有多少种标签](https://fe.ecool.fun/topic/e84bcf8c-1ee4-4c28-8e64-875b485369b5?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [ES6 - ES12](https://fe.ecool.fun/topic/e9a726d4-0ce9-4e04-88c3-9e42bad984f7?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
- [x] [字符串的常用方法有哪些](https://fe.ecool.fun/topic/39513146-d7a4-41ad-963f-ba32242ddc55?orderBy=default&order=desc&tagId=10&exerciseCate=0&ignoreMaster=1&difficulty=)
Expand Down

0 comments on commit dddad3a

Please sign in to comment.