试了用cron做站外定时请求,只要在网站代码的config.yaml文件里直接写cron服务就行了。
name: test
version: 1
accesskey: somekey
cron:
– description: test
url: index.php
schedule: every 1 mins
timezone: Beijing
由于脚本路径只能是相对路径。因此多走一步用fetchurl服务
$f = new SaeFetchurl();
$content = $f->fetch(‘http://example.com/cron.php’);
Scott Jehl 提出的解决方式是用
标签和Media Query 让浏览器自动选择合适的图片。当然现在只能用javascript来实现了。不过这是一种十分可行而且语义十足的方式,希望在某一天可以被w3c列入html规范。
代码如下:
<picture alt="A giant stone face at The Bayon temple in Angkor Thom, Cambodia">
<!-- smallest size first - no @media qualifier -->
<source src="http://farm8.staticflickr.com/7144/6547286841_635bbd97e5_m.jpg">
<!-- medium size - send to viewport widths 400px wide and up -->
<source src="http://farm8.staticflickr.com/7144/6547286841_635bbd97e5.jpg" media="(min-width: 400px)">
<!-- large size - send to viewport widths 800px wide and up -->
<source src="http://farm8.staticflickr.com/7144/6547286841_635bbd97e5_z.jpg" media="(min-width: 800px)">
<!-- extra large size - send to viewport widths 1000px wide and up -->
<source src="http://farm8.staticflickr.com/7144/6547286841_635bbd97e5_b.jpg" media="(min-width: 1000px)">
<!-- extra large size - send to viewport widths 1300px wide and up -->
<source src="http://farm8.staticflickr.com/7144/6547286841_c6160b34e2_o.jpg" media="(min-width: 1200px)">
<!-- Fallback content for non-JS or non-media-query-supporting browsers. Same img src as the initial, unqualified source element. -->
<noscript><img src="http://farm8.staticflickr.com/7144/6547286841_635bbd97e5_m.jpg" alt="A giant stone face at The Bayon temple in Angkor Thom, Cambodia"></noscript>
</picture>
//startSimulation and pauseSimulation defined elsewhere
function handleVisibilityChange() {
if (document.webkitHidden) {
pauseSimulation();
} else {
startSimulation();
}
}
document.addEventListener("webkitvisibilitychange", handleVisibilityChange, false);
/*
* If this is a browser that doesn’t support this API, we should
* start the simulation as soon as this part of the script executes.
* If it does support the API, then we should start if we’re already
* visible at this point. Otherwise, we’ll wait until we’re told
* that we should start.
*
* Browsers that don't support this API will return undefined (a false-y
* value) for document.webkitHidden, effectively defaulting to visible.
*/
if (!document.webkitHidden) startSimulation();
为网站做一个搜索历史本地储存,想法是对于ie外的浏览器可以直接使用localstorage,但是对于不争气的IE,难道只能使用cookies?
然后搜到hacker news上的一篇文章。
Store.js – cross browser local storage without using cookies or flash (github.com)
在XP下,一般位于C:\Documents and Settings\用户名\UserData,有些时候会在C:\Documents and Settings\用户名\Application Data\Microsoft\Internet Explorer\UserData。
在Vista下,位于C:\Users\用户名\AppData\Roaming\Microsoft\Internet Explorer\UserData。
userData的保存形式为XML文件。下面是支付宝保存的userData数值。
alipayuserdata[1].xml>>
3.大小限制
Security Zone Document Limit (KB) Domain Limit (KB)
Local Machine 128 1024
Intranet 512 10240
Trusted Sites 128 1024
Internet 128 1024
Restricted 64 640
线上使用时,单个文件大小限制为128KB,一个域名下文件大小限制为1024KB,文件数应该没有限制。在受限站点里这两个值分别是64KB和640KB,所以如果考虑到各种情况的话,单个文件最好能控制64KB以下。
4.使用
userData可以绑定到,几乎所有标签上。
官方文档还加了说明:
Setting the userData behavior class on the html, head, title, or style object causes an error when the save or load method is called.
apply to:
A, ABBR, ACRONYM, ADDRESS, AREA, B, BIG, BLOCKQUOTE, BUTTON, CAPTION, CENTER, CITE, CODE, DD, DEL, DFN, DIR, DIV, DL, DT, EM, FONT, FORM, hn, HR, I, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, KBD, LABEL, LI, LISTING, MAP, MARQUEE, MENU, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TEXTAREA, TT, U, UL, VAR, XMP