]> git.madduck.net Git - debian/web/pdo.git/blob - js/ie-note.js

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

initial commit
[debian/web/pdo.git] / js / ie-note.js
1 /* 
2  * ie-note.js -- alerts users of IE about lack of standards-compliance
3  *
4  * to use, source this script from the HTML file:
5  *
6  *   <script type="text/javascript" src="js/ie-note.js"></script>
7  *
8  * Note that you need an event handler, such as
9  *   http://dean.edwards.name/weblog/2005/10/add-event/
10  * or insure otherwise that insertNote() is called *after* the whole page has
11  * been rendered and the DOM initialised.
12  *
13  * The notice can be styled with CSS, using the ie-note class name.
14  *
15  * SVN url: http://svn.madduck.net/pub/web/martin-krafft.net/js/ie-note.js
16  *
17  * Copyright © martin f. krafft <madduck@madduck.net>
18  * Released under the terms of the Artistic Licence 2.0
19  *
20  * Revision: $Id: dchangesfilename 295 2006-10-07 11:20:26Z madduck $
21  */
22
23 function isIE()
24 {
25   return navigator.appName.indexOf('Internet Explorer') > 0 ||
26     navigator.appName.indexOf('MSIE') > 0;
27 }
28
29 function insertNote()
30 {
31   var query = unescape(location.search);
32   if (isIE() || query.indexOf('ie-note') > 0) {
33     var container = document.createElement("p");
34     container.className = 'ie-note';
35     container.innerHTML =
36     '<strong>Notice:</strong> you are using Microsoft\'s Internet Explorer, '
37     + 'which does not properly support the <a '
38     + 'href="http://www.w3.org/MarkUp">XHTML</a> and <a '
39     + 'href="http://www.w3.org/Style/CSS">CSS</a> standards used in writing '
40     + 'this page the way it is supposed to look. The information is still '
41     + 'all there, but for a better result, please consider alternative ' 
42     + 'browsers, such as <a href="http://www.mozilla.org/products/firefox">'
43     + 'Mozilla Firefox</a>.';
44     var body = document.getElementsByTagName("body")[0];
45     body.insertBefore(container, body.firstChild);
46   }
47 }
48
49 // see http://dean.edwards.name/weblog/2005/10/add-event/
50 addEvent(window, 'DOMContentLoaded', insertNote);