摘要:
xss攻击预防 npm i xss 前端在显示的时候替换<> 1.替换特殊字符,如 < 变成< > 变成> 2.<script>变成<script>,直接显示,而不会作为脚本执行 XSRF攻击预防 1.使用post接口 2.增加验证
阅读全文
posted @ 2020-04-11 16:04
chenlw101
阅读(117)
推荐(0)
摘要:
原则: 1、多使用内存、缓存或者其他方法 2、减少CPU计算量,减少网络加载耗时 (防抖,节流,图片懒加载) //防抖(input输入返回值)input.addEventListener('keyup', debounce(()=>{ console.log(input.value) }),600)
阅读全文
posted @ 2020-04-11 15:48
chenlw101
阅读(143)
推荐(0)
摘要:
1.DNS解析:域名->IP地址 2.浏览器根据IP地址向服务器发起http请求 3.服务器处理http请求,并返回给浏览器 渲染过程 1.根据html代码生成DOM Tree 2.根据css代码生成CSSOM 3.将DOM Tree和CSSOM整合行程Render Tree 4.根据Render
阅读全文
posted @ 2020-04-11 14:14
chenlw101
阅读(1232)
推荐(0)
摘要:
var imgurl = data; if (imgurl.indexOf("base64") != -1) { imgurl = data; } else if (imgurl.indexOf("data:image/jpeg;base64") == -1) { imgurl = "data:im
阅读全文
posted @ 2020-03-27 11:32
chenlw101
阅读(793)
推荐(0)
摘要:
<ul> <li class="liclass" >11111</li> <li class="liclass">2222</li> <li>3333</li> <li>44444</li> <li>555555</li> </ul> const lilist = document.querySel
阅读全文
posted @ 2020-03-26 10:53
chenlw101
阅读(162)
推荐(0)
摘要:
//bind Function.prototype.bind1 = function(){ let args = Array.prototype.slice.call(arguments); let t = args.shift(); let self = this; return function
阅读全文
posted @ 2020-03-21 14:54
chenlw101
阅读(309)
推荐(0)
摘要:
function fn1(){ console.log(this) } fn1();//window fn1.call({x:100});//{x:100} const fn2 = fn1.bind({x:200}) fn2();//{x:200} const zhangsan = { name:'
阅读全文
posted @ 2020-03-20 16:53
chenlw101
阅读(77)
推荐(0)
摘要:
// 闭包:自由变量的查找,是在函数定义的地方,向上级作用域查找 , 不是在执行的地方!!! // 函数作为返回值 function create(){ let a =100; return function(){ console.log(a) } } const fn = create(); co
阅读全文
posted @ 2020-03-20 16:41
chenlw101
阅读(91)
推荐(0)
摘要:
通过hasOwnProperty('name') 来查看是否是自己的属性 1.原型 // class实际上是函数,可见是语法糖 typeof Student //"function" typeof People //"function" // 隐式原型 和 显示原型 console.log(aaa.
阅读全文
posted @ 2020-03-19 18:35
chenlw101
阅读(144)
推荐(0)
摘要:
// 父类 class People{ constructor(name){ this.name = name; } eat(){ console.log(`姓名 ${this.name} eat something `) } } // 子类 class Student extends People
阅读全文
posted @ 2020-03-19 17:39
chenlw101
阅读(209)
推荐(0)