By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

How to detect the rendering mode which the browser is currently in (works for IE6).

P: n/a
<!--
// How to detect the rendering mode which the browser is currently in
(works for IE6).
// Ctrl+Shift+s displays indicates whether the browser is in quirks or
standards mode.

// Detect keypress
var captureKeys = function(ev) {
ev = ev || window.event; // gets the event in ie or ns
kCode = ev.keyCode || ev.which; // gets the keycode in ie or ns

/* in ie, when pressing the ctrl + shift + key, it gives the key code
for the capitalized key (probably because shift is pressed)
in ns pressing ctrl, shift and another key doesn't change the
keycode
thus, the || and two different numbers */

if (ev.ctrlKey && ev.shiftKey && kCode == 19 || ev.ctrlKey &&
ev.shiftKey && kCode == 83)
{ // ctrl+alt+s
ShowStatus(); // function to show browser compatibility mode
return false; // make it so the browser ignores key combo
}
if (ev.ctrlKey && kCode == 119) { // ctrl+w
closeWin(); // run your own script to close the window
// doesn't work in ie, ie just closes the window
return false;
}
}
function ShowStatus()
{
window.status = "This browser is using "+
((document.compatMode=='CSS1Compat')?"'standards'" :"'quirks'")+"
mode.";
}

function init()
{
document.onkeypress=captureKeys;
}

window.onload=init;
//-->

Apr 4 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
mark4asp wrote:
>
<!--
// How to detect the rendering mode which the browser is currently in
(works for IE6).
// Ctrl+Shift+s displays indicates whether the browser is in quirks or
standards mode.....
With IE 6, I think you can also tell if you're in quirks mode by whether
the window chrome has a 'raised' look on its inside edge. Or am I
imagining it?
Apr 4 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.