Entries Tagged ‘firefox’:

Script 元素的异步加载属性

进入正题之前,先考大家一个问题:defer 属性现在有哪些浏览器支持?

喜悦

除了 defer 属性,script 还新增了一个 async 属性,请看 MDC

async Requires Gecko 1.9.2
This Boolean attribute is set to indicate that the browser should, if possible, execute the script asynchronously. If the script cannot be executed asynchronously, or the browser doesn’t support this attribute, the script is executed synchronously (and loading the content blocks until the script finishes running).

理想情况下,利用 async 属性,脚本异步加载将变得非常简单:
async-test.js:

var g = 1;

async-test-1.html:

<script src="async-test.js" async="true"></script>
<script>
    alert(typeof g); // Firefox 3.6 弹出 undefined
</script>

测试页面:async-test-1.html
目前只有 Firefox 3.6 支持 async 属性,希望其它浏览器能迅速跟进。
阅读全文 »

Tags: , , ,

Firefox扩展更新的解决办法

最近Firefox升级老是报 download error -228. 这是升级服务器的中国镜像挂掉了引起的。

解决办法很简单,到镜像列表页面 http://www.mozilla.org/mirrors.html 找一个可以访问的服务器,ping出ip后,在hosts里绑定到releases.mozilla.org. 比如我的:

# mozilla update
204.152.184.113    releases.mozilla.org

推荐使用Primary Mirrors, 稳定可靠。

Tags:

JavaScript的几个诡异问题

先看IE的一个现象

从非常简单的一个例子开始:

f();
function f() { alert('test'); }

上面的代码所有浏览器都能正确执行,原因是“预解析”(如果不了解,请阅读 JavaScript运行机制浅探)。

稍微变化一下:

f();
var a = function f() { alert('test'); };

上面的代码在IE下能正确执行,在其它浏览器下,提示f未定义。原因是 阅读全文 »

Tags: , , ,

Firefox非主流开发扩展推荐

Firebug已经家喻户晓,不必多说。下面推荐的是些村酒野蔬,虽没什么名气,但其味醇厚甜美,食之飘香再难忘情。

HTML Validator

html_validator
http://users.skynet.be/mgueury/mozilla/

很喜欢这个扩展的Tidy算法模式,可以检查出HTML页面中绝大部分嵌套和书写错误,并且针对每个错误都有详细的说明和推荐写法。当然,很多时候,我们不大可能去纠正所有错误和警告。一个常用的小技巧是:将可以容忍的错误添加到Hidden列表中。这样,只要看看右下角的状态信息,就知道页面中是否还有错误了。

Launchy

launchy
https://addons.mozilla.org/en-US/firefox/addon/81

这个扩展相见恨晚,一见就再也离不开了。如上图所示,能很方便的 阅读全文 »

Tags: ,

Firefox下,表单元素的autocomplete属性

25日的扯淡里,碰巧发现了autocomplete的作用。今天看见realazy兄遇到按扭状态未还原问题,通过js来重置。其实用autocomplete就可以轻松解决:

<input name="submitBtn" autocomplete="off" type="submit" value="提交" />

这样,后退或刷新页面时,Firefox就不会自动记忆表单状态了。

演示页面:firefox_autocomplete_test.php

详细资料:How to Turn Off Form Autocompletion

Tags: , ,