Skip to content

Instantly share code, notes, and snippets.

View aam's full-sized avatar

Alexander Aprelev aam

  • Mountain View, CA
View GitHub Profile
@aam
aam / gist:5619322
Last active December 17, 2015 13:48 — forked from anonymous/gist:5599541
Adding "typeof scripts == 'function'" make it work on Safari 5.1
<!DOCTYPE html>
<html lang="en">
<head>
<title>document.currentScript</title>
<meta charset="UTF-8">
</head>
<body>
<h1>document.currentScript</h1>
<pre id="result"></pre>
<script type="application/javascript">
@aam
aam / gist:5233444
Last active December 15, 2015 08:49 — forked from padolsey/gist:527683
JavaScript: IE Detect
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}