473,320 Members | 1,902 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

Apr 4 '07 #1
1 2427
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
by: Dr.Tube | last post by:
Hi there, I have this web site (www.DrTube.com) which has the following DTD: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> which switches...
30
by: Matt Probert | last post by:
Is it just me (probably) or is Mozilla and the newer Firefox full of CSS rendering bugs? I ask, because some strange effects occur with Mozilla and Firefox which don't happen in Opera and dare I...
2
by: Marc Miller | last post by:
I recently deployed a webform for test on about 12 users machines. All had IE 6.0. One user received 'Server Error in 'TestApp' Application'. We discovered that the user needed IE sp1. Is...
9
by: Yaron C. | last post by:
Hi, Is there is a way to detect Service Pack 2 for XP in JS ? Can I know it from navigator.userAgent ? Thanks, Yaron
5
by: Yama | last post by:
Hi, I have 20 javascript files I would like to dynamically write to my rendered web page. What I would like to do is instead of saving them into a database table save them into a XML file then...
4
by: ATS16805 | last post by:
Hi. I wonder if it's possible to "force" a browser to "switch to SSR mode" for any given document. Specifically, I'm looking for a solution, not to a User Agent issue (i think), but a coding idea;...
22
by: Harry Haller | last post by:
Is there any other way apart from: document.compatMode == 'CSS1Compat' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta...
0
by: Homer | last post by:
Hi, My app is written using ASP.NET 2.0 and my development machine has IE7 loaded. Being a beginner, I was not aware of the HTML rendering problems that exist in different browser, e.g. IE6 vs....
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.