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



<!--
// 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;
//-->

.



Relevant Pages

  • Re: opening a new window
    ... With the "reuse existing browser" unchecked, and using the shift button, you ... "vavud" wrote in message ...
    (microsoft.public.windowsxp.basics)
  • Cant locate object method - weirdness
    ... my $self = shift; ... Also on a side issue the HTML isn't being interpreted by the browser, I've set the content type to be text/html - so don't understand that one either. ...
    (perl.beginners)
  • When I shift open turns into a small icon on the screen.
    ... When I use "Open in new browser" by holding down shift - Or if the reference uses "Open in new browser" the browser pops up as a shrinked icon on the screen. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • comp.lang.javascript FAQ - Quick Answers 2008-10-13
    ... Javascript Tips ... _How can I disable the back button in a web browser_? ... _How do I check to see if a child window is open, ... upon the cache headers that your server sends. ...
    (comp.lang.javascript)
  • Re: Page layout for tubie pages on the net Re: Deep Space 845 55WSET amps.
    ... picture on the right ... Just to add a bit of explanation, the viewing browser might have ... browser will then word wrap to the viewer's window. ... in one cell and the text in another. ...
    (rec.audio.tubes)