472,958 Members | 2,172 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 2402
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....
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.