前端学习之零散知识点详解(二)

一、js操作BOM:

参考:https://blog.csdn.net/weixin_43638968/article/details/109259167

 

 

 

 1、怎么获取浏览器版本?(navigator 浏览器对象)

//如何检测是否为Chrome浏览器
var ua = navigator.userAgent;
console.log(ua);
var isChrome =ua.indexOf('Chrome');
console.log(isChrome); // true为是,false为不是

2、回到上一页?(history 历史对象)

history.go() //前进或后退指定的页面数 history.go(num);
history.back()// 后退一页
history.forward() // 前进一页

3、屏幕(screen 屏幕对象)

screen.width;//屏幕宽度
screen.height; //屏幕高度

4、解析URL(location 地址对象)

location.href-- 返回或设置当前文档的URL
location.search -- 返回URL中的查询字符串部分。例如 http://www.dreamdu.com/dreamdu.php?id=5&name=dreamdu 返回包括(?)后面的内容?id=5&name=dreamdu
location.hash -- 返回URL#后面的内容,如果没有#,返回空
location.host -- 返回URL中的域名部分,例如www.dreamdu.com
location.hostname -- 返回URL中的主域名部分,例如dreamdu.com
location.pathname -- 返回URL的域名后的部分。例如 http://www.dreamdu.com/xhtml/ 返回/xhtml/
location.port -- 返回URL中的端口部分。例如 http://www.dreamdu.com:8080/xhtml/ 返回8080
location.protocol -- 返回URL中的协议部分。例如 http://www.dreamdu.com:8080/xhtml/ 返回(//)前面的内容http:
location.assign -- 设置当前文档的URL
location.replace() -- 设置当前文档的URL,并且在history对象的地址列表中移除这个URL location.replace(url);
location.reload() -- 重载当前页面

 

二、JS事件绑定 事件冒泡与捕获 事件代理:

https://blog.csdn.net/weixin_40693643/article/details/104149024

 

三、跨域资源共享CORS详解:

http://www.ruanyifeng.com/blog/2016/04/cors.html

 

四、vue双向绑定Object.defineProperty结合发布者订阅者模式:

https://www.cnblogs.com/zhenfei-jiang/p/7542900.html

 

五、http与https的区别

1、端口:HTTP为80,HTTPS为443

2、HTTP运行在TCP上,明文传输,HTTPS运行在SSL/TLS(TCP上)上,加密传输

3、HTTPS需要CA证书,能防止运营商劫持

 

六、HTTP1.0、1,1、2.0的区别

1、https://blog.csdn.net/ailunlee/article/details/97831912(面试)

2、https://blog.csdn.net/sq4521/article/details/104005408(深入)

★1.1与1.0:长链接(keep-alive),节约带宽(断点续传)、缓存设置(etag,if-none-match,if-modified-since)、

host域(一台物理服务器多台虚拟主机)、状态码增加(409请求资源与资源当前状态冲突、410永久删除)

★1.1与2.0:多路复用(多个TCP)、头部压缩(header压缩)、服务器推送(如客户端发起申请xx.html请求,未发起请求js和css时服务器预先传送xx.js和xx.css)

 

七、

posted @ 2021-05-08 22:24  小周不爱吃鱼  阅读(49)  评论(0)    收藏  举报