なお、document.charset,document.defaultCharset,document.actualEncodingについては使えないようです。これらが利用できる可能性がありましたら、それについての解答でも結構です。
HTMLにちゃんと言語してをする。
<html lang="ja">
<meta http-equiv="content-type" content="text/html;
charset=shift-jis">
<script type="text/javascript" charset="shift-jis">
http://iandeth.dyndns.org/mt/ian/archives/000622.html
document.charsetはIEのみと思いますが。
Firefoxでは"document.characterSet"ですね
<script language="JavaScript"> if(document.all){ // IE用 alert(document.charset) }else{ // IE以外 alert(document.characterSet) } </script>
うーむ、やっぱり似たような名前で対応していたんですね。ありがとうございます。
document.charsetについてはその通りですね。
念のため、という意味で書いておきましたものです。
さて、回答についてですが、JavaScriptで判別しようとしているページは不特定で、編集不可能なものを対象としています。
ですので、お答えいただいた方法を使用することは出来ません。
後付け条件のようになってしまって申し訳ないです。