billfeller
billfeller
### 1. 微信小程序JS为什么无法使用 document,window 等。 由于小程序开发框架的逻辑层并非运行在**浏览器环境**中,而是运行在App Service Thread中,视图层View运行在View Thread,由Webview实现渲染,两者之间通过JSBridge实现通信。  下图说明了 **Page 实例的生命周期**。  ### 2. 为什么在微信开发者工具中正常,但是在真机中调试却异常,如样式异常,es6语法报错? 首先,需要明确小程序目前可运行于各不相同的三端: 1. 在 iOS 上,小程序的 Javascript 代码是运行在 JavaScriptCore 中,视图层是由 WKWebView 来渲染的,环境有 iOS8、iOS9、iOS10 2....
### 原理 微信小程序本质实现还是基于webview嵌套网页来实现,不过微信针对Webview体验性能问题给出了自己的一套解决方案,在这个基础上实现虚拟DOM(类似React),资源离线管理,WeixinAPI集成。所以理论上,微信内置浏览器访问网页的那套调试方法仍然适用于微信小程序。 ### 方法 1. Android系统开启USB调试;见 [Get Started with Remote Debugging Android Devices][1] 2. Windows安装TBS Studio,开启微信调试功能;见 [TBS开发调试利器——TBS Studio][3] 3. 完成以上两步后,就可以使用Chrome对微信小程序进行调试,也可以很容易查看第三方应用的前端实现方法。 ### 推荐阅读 1. [Get Started with Remote Debugging Android...
### use **sw-precache** to precache assets: ```javascript gulp.task('generate-service-worker', function(callback) { var path = require('path'); var swPrecache = require('sw-precache'); var rootDir = 'app'; swPrecache.write(`${rootDir}/service-worker.js`), { staticFileGlobs: [rootDir + '/**/*.{js,html,css,png,jpg,gif,svg,eot,ttf,woff}'], stripPrefix: rootDir...
### IE6 来源:《精通CSS 高级Web标准解决方案》第9章 1. 双外边中距浮动bug 2. 3px文本偏移bug 3. 重复字符bug 4. peek-a-boo bug 5. 相对容器中的绝对定位bug ### IE7 1. [IE7 float right problems][4]  ### IE8 1. [max-width: 100%; causes IMAGES...
## What is position:sticky? > **position:sticky** is a CSS positioning attribute that allows you to fix an element to the viewport (i.e, anchor it to the top of the screen)...
```javascript window.scrollTo(0, 0) ``` [MDN Window.scrollTo()](https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo)
转载《[Document.Referrer丢失的几个原因](http://www.imkevinyang.com/2010/01/document-referrer%E4%B8%A2%E5%A4%B1%E7%9A%84%E5%87%A0%E4%B8%AA%E5%8E%9F%E5%9B%A0.html)》 ### Referrer的重要性 HTTP请求中有一个referer的报文头,用来指明当前流量的来源参考页。例如在www.sina.com.cn/sports/上点击一个链接到达cctv.com首页,那么就referrer就是www.sina.com.cn/sports/了。在Javascript中,我们可以通过document.referrer来获取同样的信息。通过这个信息,我们就可以知道访客是从什么渠道来到当前页面的。这对于Web Analytics来说,是非常重要的,这可以告诉我们不同渠道带来的流量的分布情况,还有用户搜索的关键词等,都是通过分析这个referrer信息来获取的。 但是,出于各种各样的原因,有时候Javascript中读到的referrer却是空字符串。下面总结一下哪些情况下会丢失referrer。 ### Referrer丢失的几个场景 #### 修改Location对象进行页面导航 Location对象是一个用于页面导航的非常实用的对象。因为他允许你只变更Url的其中一部分。例如从cn域名切换到com域名,其他部分不变: ```javascript window.location.hostname = "example.com"; ``` 但是,通过修改Location进行页面导航的方法,会导致在IE下丢失Referrer。 IE5.5+ 下返回空字符串 Chrome3.0+,Firefox3.5,Opera9.6,Safari3.2.2均正常返回来源网页 #### window.open方式打开新窗口 示例 ```html 访问Google ``` 点击此链接会在新窗口打开Google网站,我们在地址栏中输入以下js代码就可以看到发送的referrer了。 ```javascript javascript:alert(document.referrer) ```...
> last > stops processing the current set of ngx_http_rewrite_module directives and starts a search for a new location matching the changed URI; > break > stops processing the current...
系统 ``` # uname -a # 查看内核/操作系统/CPU信息 # head -n 1 /etc/issue # 查看操作系统版本 # cat /proc/cpuinfo # 查看CPU信息 # hostname # 查看计算机名 # lspci -tv # 列出所有PCI设备 # lsusb...