「テキスト ファイル (*.txt)」で「名前を付けて保存」する。
ついでに。
SaveAsTEXT.htm
<html>
<head>
<script language=jscript defer>
var title=external.menuArguments.top.document.title;
if(title==""){
a1.href=external.menuArguments.top.document.URL;
title=new ActiveXObject("Scripting.FileSystemObject").GetFileName(decodeURI(a1.pathname));
}
title=title.replace(/[.:\\\/*?<>|"]/g,"_");
external.menuArguments.top.document.execCommand("saveas",true,title+".txt");
</script>
</head>
<body>
<a id=a1 ></a>
</body>
</html>
SaveAsFILE.reg
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\テキスト ファイル(&-)]
@="C:\\どこか\\SaveAsFILE.htm"
document.execCommand("SaveAs")で、ファイル名に*.txtを指定しても、
ie.ExecWB(OLECMDID_SAVEAS)で、タイトルに*.txtを指定しても、どちらでもできます。
« ファイル名で「名前を付けて保存」する。 | トップページ | フォームを送信して戻るとフォームの入力データが消える問題を回避する。 »