上一页 1 2 3 4 5 6 ··· 13 下一页

2021年9月10日

摘要: 方法1:给 a 标签添加 rel 属性 <a href="https://an.evil.site" target="_blank" rel="noopener">恶意网站</a> 方法2:打开子窗口时将子窗口的 opener 设置为 null const newWin = window.open( 阅读全文
posted @ 2021-09-10 10:04 aisowe 阅读(36) 评论(0) 推荐(0) 编辑
摘要: window.onpopstate = function(res) { console.log(res) } 注意: pushState()或replaceState()不能触发该事件; 用户点击前进、后退,或 History.back()、History.forward()、History.go( 阅读全文
posted @ 2021-09-10 10:03 aisowe 阅读(31) 评论(0) 推荐(0) 编辑
摘要: window.onhashchange = function (e) { console.log(e) } 如果pushState的 URL 参数设置了一个新的锚点值(即hash),并不会触发hashchange事件。反过来,如果 URL 的锚点值变了,则会在 History 对象创建一条浏览记录 阅读全文
posted @ 2021-09-10 10:01 aisowe 阅读(264) 评论(0) 推荐(0) 编辑
摘要: Boolean null, undefined, false, NaN, '', +0, -0, 0n --> false,其它均为 true Number 能转则转,不能则 NaN(undefined),特例 Symbol 会报错。 String "true", "0", "1,2", "[obj 阅读全文
posted @ 2021-09-10 10:01 aisowe 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 浏览器 JS 引擎 Firefox SpiderMonkey Safari Nitro/JavaScript Core Chrome V8 IE Chakra Edge ChakraCore 狐猴、V8、查克拉 阅读全文
posted @ 2021-09-10 10:01 aisowe 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 浏览器 渲染引擎 Firefox Gecko Safari WebKit Chrome Blink IE Trident Edge EdgeHTML FG - > SW → CB → IT → EE 阅读全文
posted @ 2021-09-10 09:59 aisowe 阅读(65) 评论(0) 推荐(0) 编辑
摘要: bash npm i ts-node -g npm i nodemon -g index.ts const foo: string = 'Hello' console.log(foo) bash nodemon index.ts 阅读全文
posted @ 2021-09-10 09:58 aisowe 阅读(113) 评论(0) 推荐(0) 编辑
摘要: index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> </head> <body> <h3>Hello, World!</h3> <script> const finalStyleObject = window.getCo 阅读全文
posted @ 2021-09-10 09:57 aisowe 阅读(9) 评论(0) 推荐(0) 编辑
摘要: index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> </head> <body> <button onclick="clickHandler()">打开窗口</button> <script> function clic 阅读全文
posted @ 2021-09-10 09:57 aisowe 阅读(140) 评论(0) 推荐(0) 编辑
摘要: index.js performance.now() 阅读全文
posted @ 2021-09-10 09:55 aisowe 阅读(24) 评论(0) 推荐(0) 编辑
摘要: index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> </head> <body> <div>Hello, World!</div> <script> window.onmouseup = function () { co 阅读全文
posted @ 2021-09-10 09:55 aisowe 阅读(18) 评论(0) 推荐(0) 编辑
摘要: index.js window.scrollX window.scrollY window.pageXOffset // window.scrollX 别名 window.pageYOffset // window.scrollY 别名 注意:只读、初始为 0,0 阅读全文
posted @ 2021-09-10 09:55 aisowe 阅读(334) 评论(0) 推荐(0) 编辑
摘要: index.js const instance = {}; console.log(instance.__proto__ Object.prototype); // true, 浏览器才需要部署 console.log(instance.constructor.prototype Object.pr 阅读全文
posted @ 2021-09-10 09:54 aisowe 阅读(96) 评论(0) 推荐(0) 编辑
摘要: index.js window.screenX window.screenY 阅读全文
posted @ 2021-09-10 09:53 aisowe 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 组件属性返回浏览器的组件对象,只读,只有 visible 属性,表示这些组件是否可见。 index.js window.locationbar.visible // 地址栏是否可见 window.menubar.visible // 菜单栏是否可见 window.scrollbars.visible 阅读全文
posted @ 2021-09-10 09:53 aisowe 阅读(84) 评论(0) 推荐(0) 编辑
摘要: index.js function Person() {} Person.prototype.sayHello = function () {}; console.log(Object.getPrototypeOf(new Person())); // {sayHello: ƒ, construct 阅读全文
posted @ 2021-09-10 09:53 aisowe 阅读(52) 评论(0) 推荐(0) 编辑
摘要: index.js // 构造函数和一般函数没有区别,都可以通过 name 属性获取函数名 function Person() {} const lilei = new Person(); console.log(lilei.constructor.name); // 'Person' console 阅读全文
posted @ 2021-09-10 09:52 aisowe 阅读(68) 评论(0) 推荐(0) 编辑
摘要: index.js window.outerHeight window.outerWidth 注意:包含浏览器菜单、边框、只读 阅读全文
posted @ 2021-09-10 09:52 aisowe 阅读(42) 评论(0) 推荐(0) 编辑
摘要: index.js window.devicePixelRatio // 比例越大,表示诠释一个 CSS 像素所有的物理像素就越多,屏幕也就越高清 阅读全文
posted @ 2021-09-10 09:51 aisowe 阅读(79) 评论(0) 推荐(0) 编辑
摘要: index.js function Person() { this.race = "human being"; // 实例属性 } Person.prototype.color = "yellow"; // 公共属性/原型属性 const instance = new Person(); insta 阅读全文
posted @ 2021-09-10 09:51 aisowe 阅读(66) 评论(0) 推荐(0) 编辑
摘要: index.js window.frames; // 返回类数组对象,元素包括 <frame> 和 <iframe> 阅读全文
posted @ 2021-09-10 09:50 aisowe 阅读(48) 评论(0) 推荐(0) 编辑
摘要: index.js window.innerHeight window.innerWidth 注意:返回当前页面可视区域宽高(不包含书签栏、搜索栏等)、页面放大时这对属性会变小、只读、包含滚动条宽高、对应 vw 和 vh 单位; 阅读全文
posted @ 2021-09-10 09:50 aisowe 阅读(500) 评论(0) 推荐(0) 编辑
摘要: index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> </head> <body> <h1> <iframe src="./sub.html" frameborder="0"></iframe> </h1> </body> 阅读全文
posted @ 2021-09-10 09:49 aisowe 阅读(15) 评论(0) 推荐(0) 编辑
摘要: index.js window.frames.length window.length // true 阅读全文
posted @ 2021-09-10 09:49 aisowe 阅读(130) 评论(0) 推荐(0) 编辑
摘要: index.js window; // 最常用 window.self; // 别名 window.frames; // 别名 window.window; // 只读属性 window.parent; // 框架窗口中使用 window.top; // 框架窗口中使用 阅读全文
posted @ 2021-09-10 09:48 aisowe 阅读(34) 评论(0) 推荐(0) 编辑
摘要: history.length 阅读全文
posted @ 2021-09-10 09:48 aisowe 阅读(30) 评论(0) 推荐(0) 编辑
摘要: index.html <script id="script"> // .text || .innerText || .innerHTML alert(document.getElementById("script").text); </script> 阅读全文
posted @ 2021-09-10 09:47 aisowe 阅读(609) 评论(0) 推荐(0) 编辑
摘要: index.js const instance = { name: "lilei", age: 13, }; Object.defineProperty(instance, "gender", { value: 1, enumerable: false, }); Object.getOwnPrope 阅读全文
posted @ 2021-09-10 09:47 aisowe 阅读(53) 评论(0) 推荐(0) 编辑
摘要: 回退到某个历史版本 git-bash git reset --hard commit_id 如果是回退到上一个版本,可以用便捷写法:git reset --hard HEAD^ 阅读全文
posted @ 2021-09-10 09:46 aisowe 阅读(189) 评论(0) 推荐(0) 编辑
摘要: index.js const objProto = {}.__proto__ || Object.getPrototypeOf({}) || Object.prototype; console.log(Object.getPrototypeOf(objProto) || objProto.__pro 阅读全文
posted @ 2021-09-10 09:46 aisowe 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 会话固定, 会话劫持, 中间人, 跨站脚本, 跨站请求伪造攻击. 阅读全文
posted @ 2021-09-10 09:45 aisowe 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 回到最新的版本 git-bash # 查看切换记录 git reflog # 找到最新提交的 commit_id 并转至最新 git reset --hard commit_id 阅读全文
posted @ 2021-09-10 09:45 aisowe 阅读(1034) 评论(0) 推荐(0) 编辑
摘要: index.js window.scrollTo(x, y); // 绝对值滚动 window.scrollBy(x, y); // 相对值滚动 注意:如果不是要滚动整个文档,而是要滚动某个元素,可以使用:Element.scrollTop()、Element.scrollLeft()、Elemen 阅读全文
posted @ 2021-09-10 09:44 aisowe 阅读(51) 评论(0) 推荐(0) 编辑
摘要: index.ts import * as _ from "lodash"; const list: Array<any> = ["", false, 0, NaN, undefined, null, 1]; const arr = _.compact(list); console.log(arr); 阅读全文
posted @ 2021-09-10 09:44 aisowe 阅读(513) 评论(0) 推荐(0) 编辑
摘要: 有三种方法: 1. Function.prototype.call(); 2. Function.prototype.apply(); 3. Function.prototype.bind(); 一、Function.prototype.call() 可以指定函数在参数对象环境下执行; var ob 阅读全文
posted @ 2021-09-10 09:43 aisowe 阅读(51) 评论(0) 推荐(0) 编辑
摘要: 有三种方法: 1. Function.prototype.call(); 2. Function.prototype.apply(); 3. Function.prototype.bind(); 一、Function.prototype.call() 可以指定函数在参数对象环境下执行; var ob 阅读全文
posted @ 2021-09-10 09:43 aisowe 阅读(111) 评论(0) 推荐(0) 编辑
摘要: index.js function clickHandler() { const newWindow = window.open( "./sub.html", "_blank", "left=100,top=100,height=500,width=800" ); setTimeout(functi 阅读全文
posted @ 2021-09-10 09:42 aisowe 阅读(534) 评论(0) 推荐(0) 编辑
摘要: 不一定, 某些浏览器具有会话恢复功能. 阅读全文
posted @ 2021-09-10 09:42 aisowe 阅读(312) 评论(0) 推荐(0) 编辑
摘要: 事件监听函数内部使用 this 会报错,原因是 this 的指向变成了事件触发对应的 DOM 节点,因此需要固定 this,方法有三种: index.js import React from 'react' import ReactDOM from 'react-dom' class Counter 阅读全文
posted @ 2021-09-10 09:41 aisowe 阅读(94) 评论(0) 推荐(0) 编辑
摘要: index.js const obj = { foo() { console.log(this); // obj const self = this; const bar = (function () { console.log(self); // obj })(); }, }; obj.foo() 阅读全文
posted @ 2021-09-10 09:40 aisowe 阅读(18) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 13 下一页

导航