基于 HTML5 的 EventSource 实时推送实现
rce)!=="undefined") { var source=new EventSource("/chat.php"); source.onmessage = function(event) { document.getElementById("result").innerHTML=event.data + " "; }; }else{ document.getElementById("result").in...
不靠谱的 execCommand 之 insertText
最近发现编辑器在执行 insertHTML 遇到剪切板内容为标签时,出现的怪异现象,于是改成了 insertText。实在搞不懂 MDN 上的 paste 是什么作用,被坑了好几次。document.execCommand("insertText",false,text);上面的方式做了一次变更,因为 insertText 粘贴的时候会产生很多节点,不能很好的处理换行,不知道怎么回事,最后改为如下。documen...
基于JavaScript在线头像图片编辑前端后台实现
ss="preview-container">' +'<img src="" class="jcrop-preview" alt="Preview">' +'</div>' +'</div>'; $(document.body).append($preview_html); var $preview = $('#preview-pane'), $pcnt = $('#preview-pane .preview-c...
Nginx SSL 代理设置完整示例
g; } location ~ ^\/index\.php { #rewrite ^/(.*) /index.php/$1 break; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+\.php)(.*)$; inc...
服务还是自己的最靠谱,第三方服务一定会坏
lace this render call where appropriate --> <script type="text/javascript"> (function () { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.googl...
Jquery绑定Ajax请求全局错误处理不生效的问题
每个请求发生错误都单独处理,那是非常可怕的, 设计全局错误处理是非常重要的。 看 JQ 的官方文档,提供了 ajaxError 的错误处理方法,该方法在 Jquery 比较新的后续版本中只支持绑定在 document 上了。看官方文档给人的感觉是,你只能使用 ajax 才能有效,什么 get,post, getJson, getScript 等都不一定会生效,如果想不被全局错误处理干扰,可以设置 global:f...
Chrome插件在高版本浏览器中安装报错解决
306.cn/otn/leftTicket/init*"], "js": ["Lib/jquery.min.js", "12306autoselected.user.js"], "run_at": "document_end" } ] } manifest version 2: { "name": "抢票插件第二代",//程序名称 "version": "1.0",//版本信息 "manifest_versi...
写网页爬虫遇到标签匹配难题
时,由于标签里面的 JavaScript 代码中含有大于号“>”导致无法匹配完整的标签内容。将这样的问题分享出来,不知道像百度啊他们的爬虫是如何处理这样的问题的。请看下面的代码: <!-- HTML DOCUMENT --> <IMG onmousewheel="return imgzoom(this);" onmouseover="if(this.width>screen.width*0.7) {this.re...
cf proxy 301 too many times
, and between Cloudflare and your origin server, to prevent data theft and other tampering. SSL/TLS documentation Advanced Certificate Manager Unlock more control and flexibility for your Certificates and SSL...
油猴子插件指南
thor You // @match https://domain.com/* // 这里非常重要 // @grant GM_xmlhttpRequest // 这里是引用功能 // @run-at document-end // @connect * // ==/UserScript== (function() { 'use strict'; GM_xmlhttpRequest({ "method": "pos...