Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<title>IE capabilities detection (clientCaps)</title>
<script type="text/javascript">
var r = document.documentElement, capabilities;
r.addBehavior("#default#clientCaps");
capabilities =
// TODO: should probably convert result to plain array (since different engines return different things -- arrays, nodelists, objects, etc.)
var query = (function() {
var engine, engines = 'NW.Dom.select,base2.dom.querySelectorAll,Sizzle,$$,$,YAHOO.util.Selector.query,dojo.query,Ext.DomQuery.select'.split(',');
while ((engine = engines.shift())) {
if (Function('try{return ' + engine + '}catch(e){}')()) {
return Function('cssExpr, ctx', 'ctx || (ctx = document);return ' + engine + '(' +
(engine.indexOf('base2') > -1 ? 'ctx, cssExpr' : 'cssExpr, ctx') + ')');
}
}
return 'querySelectorAll' in document ?
// this is how I fixed IE6-8 crashing on
// dynamic insertion of at-rules inside
// stylesheets (for example @font-face)
// UPDATE:
// Fix by MS, move up the style insertion
// before the stylesheet rule manipulation
function setStyle(rules) {
var d = document,
Adobe Flash LSO (Local Shared Objects) are like super-cookies that never expire and cannot be removed by browsers.
The Flash plugin installed in your system allows sites to write/share sensitive informations on your hard disk.
These are the simple info I currently have on how to make folders immutable on *NIX OS (Mac and Linux).
I have not been able to make immutable folders on my Windows XP VM maybe because I only use FAT32.
It seems that Windows allows you to lock files and folders on NTFS volumes only (I miss the info).
The following are the location of the folder that should be made immutable on each OS,
<html>
<head>
<title>TouchEvent detection for iPhone/iPod/iPad</title>
<script type="text/javascript">
var isTouch = (function() {
var event, feature = false,
support = function() { feature = true; },
element = document.createElement('div');
var loadScript = (function(global) {
return function(url) {
var script,
// document reference
doc = global.document,
// root element reference
Prototype._original_property = window.NW;
//= require "repository/src/nwmatcher"
Prototype.Selector = (function(engine) {
function select(selector, scope) {
return engine.select(selector, scope || document, Element.extend);
}
return {
engine: engine,
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Focus Test</title>
<style type="text/css">
:focus { background-color: red; }
</style>
<script type="text/javascript">
window.onload = function() { document.body.setAttribute("tabindex", "1"); };
js> File
function File() {
[native code]
}
js> Object.prototype.toString.call(File)
[object Function]
js>
js> stats("File")
0 0x10084a200 "separator" ENUMERATE READONLY slot 11 flags 4 shortid 0
0 0x10084a1c8 "error" ENUMERATE slot 10 flags 0 shortid 0
<!DOCTYPE html>
<html>
<head>
<title>DOM Event test: order of execution</title>
<script type="text/javascript">
// W3C DOM Event test
(function() {
if (document.addEventListener) {