上午,朋友從國外給發了一個鏈接,告訴我這事一個很有意思的插件(http://plugins.jquery.com/project/crash)--可以直接讓IE6崩潰。對于前端開發者來說,對于IE6可能大傷腦筋。打開代碼源文件,只見到以下代碼:
/**
* jQuery Crash (http://mktgdept.com/jquery-crash)
* A jQuery plugin to crash IE6.
*
* v0.0.2 - 5 March 2010
*
* Copyright (c) 2009 Chad Smith (http://twitter.com/chadsmith)
* Dual licensed under the MIT and GPL licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/gpl-license.php
*
* Use $.crash();
*
**/
;jQuery.crash=function(x){for(x in document.open);};
看到代碼,我百思不得其解。它如何工作?通過搜索,在《jQuery one-line plugin to crash IE6》找到了一點答案--通過一段惡意的代碼使瀏覽器崩潰。但他如何工作,我還是一頭霧水。該文章有很多相關的評論,說法不一。