//このスクリプトだけでは動作しないです。他、レジストリへの登録も必要。 <title>ExpContext</title> <script type="text/JScript"> var ext; function Coerce() { if (!catchComplete()) return; var s = ""; var html, i; s += "<style type='text/css'>\n"+ "* { font-family:'" + unescape("%uFF2D%uFF33%20%u30B4%u30B7%u30C3%u30AF") + "', monospace !important;}\n"+ "BODY { background:#fff; color:#000;}\n"+ "BODY, TD, TH, DIV, P, BLOCKQUOTE { line-height:170%;}\n"+ "TABLE { border:1px solid #888;}\n"+ "TD, TH { padding:5px; border:1px solid #888; background:#f5f5f5;}"+ "PRE, TT, SMALL { font-size:100%;}\n"+ "SPAN.noscriptDecoration { background:#cfc; color:#080;}\n"+ "A:link { color:#00f; text-decoration:underline;}\n"+ "A:visited { color:#808; text-decoration:underline;}\n"+ "A:active, A:hover { color:#f00; text-decoration:underline;}\n"+ "<\/style>\n"; s += "<base href='" + ext.location.href + "'>\n"; s += "<body>\n"; var frm = ext.top.frames; var frmDoc = ext.top.document; if (frm.length) { var msg = { "このページにはフレームが使われています。": "%u3053%u306E%u30DA%u30FC%u30B8%u306B%u306F%u30D5%u30EC%u30FC%u30E0%u304C%u4F7F%u308F%u308C%u3066%u3044%u307E%u3059%u3002", "(<iframe>が含まれています)": "%uFF08%26lt%3Biframe%26gt%3B%u304C%u542B%u307E%u308C%u3066%u3044%u307E%u3059%uFF09", "(フレーム名:": "%28%u30D5%u30EC%u30FC%u30E0%u540D%uFF1A", "なし": "%u306A%u3057", "<noframes>の内容": "%26lt%3Bnoframes%26gt%3B%u306E%u5185%u5BB9" } for (i in msg) msg[i] = unescape(msg[i]); s += "<div>"; s += "<strong style='color:red'>" + msg["このページにはフレームが使われています。"]; if (frmDoc.getElementsByTagName("iframe").length) s += msg["(<iframe>が含まれています)"]; s += "</strong><br>\n"; for (i = 0; i < frm.length; i++) s += "<a href='" + frm[i].location.href + "'>" + frm[i].location.href + msg["(フレーム名:"] + (frm[i].name ? frm[i].name : msg["なし"]) + ")</a><br>\n"; html = frmDoc.body.innerHTML; if (frmDoc.getElementsByTagName("noframes").length) { s += "<p><strong style='color:red'>" + msg["<noframes>の内容"] + "</strong></p>\n"; s += html.replace(/<noframes/gi, "<Xnoframes"); } s += "<hr style='margin-bottom:5em;'>\n"; s += "</div>\n"; } var regObj, rep = new Array( " style=", " bgcolor=", " background=", " onmouseout=", " onmouseover=", " onmousedown=", " onmouseup=", " onclick=", " onkeypress=", " onchange=", " onselect=", " onload=", " onunload=", " onabort=", " onerror=", " onfocus=", " onblur=", " onsubmit=", " onreset=", "<font", "<nobr" ); html = ext.document.body.innerHTML; for (i = 0; i < rep.length; i++) { regObj = new RegExp(rep[i], "gi"); html = html.replace(regObj, rep[i].charAt(0) + "X" + rep[i].substring(1, rep[i].length)); } html = html.replace(/<script/gi, "<\!--<Xscript"); html = html.replace(/\/\/.?--\>/gi, "//"); html = html.replace(/<\/script>/gi, "<\/script>-->"); html = html.replace(/<noscript/gi, "<span class='noscriptDecoration'><Xnoscript"); html = html.replace(/<\/noscript>/gi, "</noscript></span>"); s += html; s += "<\/body>"; try { var win = ext.open(); with (win.document) { open(); write(s); close(); title = ext.top.document.title; } win.focus(); window.close(); } catch(e) { errorMsg(e); } } var someWinObj; function SomeWin() { if (someWinObj) { if (ext.top.frames.length) { var frm = someWinObj.top.document.getElementsByTagName("frame"); for (i = 0; i < frm.length; i++) { frm[i].src = ext.top.frames[i].location.href; } } someWinObj.focus(); window.close(); } else if (catchComplete()) { try { someWinObj = ext.window.open(ext.top.location.href); setTimeout("SomeWin()", 500); } catch(e) { errMsg(e); } } } function Explorer() { var appObj = new ActiveXObject("Shell.Application"); appObj.ShellExecute("C:\\Windows\\explorer.exe","D:\\Desktop\\siteCTS"); window.close(); } function catchComplete() { return ext; } function errorMsg(e) { alert("予期せぬ、あるいは不可抗力のエラーが発生しました。\n安全のためスクリプトの実行を中断します。\n\nError Name: " + e.name + "\nError Message: " + e.message + "\nError Number: " + e.number); window.close(); } ////// function srcWri() { var s; if (window.opener) { s = "<input type='button' onclick='Coerce()' value='Coerce'><br>"+ "<input type='button' onclick='SomeWin()' value='ウィンドウを複製'><br>"+ "<input type='button' onclick='Explorer()' value='エクスプローラ'><br>"; } else { s = "<p>このファイルはIEのコンテキストメニュー拡張用のプログラムファイルです。<br>直接開くことはできません。</p>"; } document.write(s); } srcWri(); </script>