Open wshallum opened 2 years ago
Hey @wshallum , could you clarify the use-case, why renaming to .hta
? I guess, you can also add the meta tag using the MarkupPreHead tiddler; the question I guess is whether it's a good idea to add the meta tag to the core or this is some very narrow case and it is good enough that you've found the solution for yourself.
Hi @YakovL - I renamed it to .hta
because it seems to be the simplest way to get local saving working in Windows without any additional applications.
I tested using MarkupPreHead
as you suggested but it seems to not work there (too late?). I needed to put it at the top of the <head>
element ahead of the <script id="versionArea"
for it to work.
I still think the general point about documenting what version of IE it expects to run on is valid.
Ah, so did I get you correctly?:
it works (via ActiveX, I suppose) if both TW's extension is changed to .hta
and the X-UA-Compatible
meta tag is added directly before script id="versionArea"
, like this (what value do you use? which ones work among those listed here and here?):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=___" />
<script id="versionArea" type="text/javascript">
Once we're clear about the versions, I'll be able to look for some alternatives as changing extension doesn't sound like a friendly user experience anyway. If we put this into the core, we have to describe such usage in docs as well, so need to investigate the context.
<meta http-equiv="X-UA-Compatible" content="IE=11" />
- I can report that using IE=Edge
also works (this is what TW5 is using and may be preferred as it does not lock it into an older version, when used in an HTA this runs it in IE11 mode for me). The reason for changing extensions is that HTA is considered an "application" (as opposed to "web page") and still has access to the FileSystemObject for manipulating local files.
Oh wow, so it actually works not "inside IE", but as a standalone "app" (IE without tabs?). That's quite an interesting approach (in terms of UX)! I do agree that this should be documented (along with side effects, like UTF-16 encoding), and probably the meta tag should be added. I'll investigate this further later. Thanks for sharing! Probably worth sharing in the google group as well.
Thank you!
If you're interested: the UTF-16 encoding can be worked around in an HTA by using ADODB.Stream
(docs) instead of Scripting.FileSystemObject
e.g.
var s = new ActiveXObject("ADODB.Stream");
s.Type = 2; // adTypeText
s.Charset = "utf-8";
s.Open();
s.WriteText("\u2665", 0); // 0 = adWriteChar (no EOL)
s.SaveToFile("out.txt");
s.Close();
it works to save in UTF-8 however there's a UTF-8 BOM (EF BB BF
) pasted in front of it.
$ xxd out.txt
00000000: efbb bfe2 99a5 ......
I'm having trouble saving when the empty file is renamed to
.hta
. The cause is HTA defaults to IE6 compatibility if not forced by theX-UA-Compatible
meta tag and the use of.classList.add(
in Messages.js here:https://github.com/TiddlyWiki/TiddlyWiki/blob/536439d854dca721275ff1140e9b2d19711b168a/js/Messages.js#L23
is causing it to throw an exception (https://caniuse.com/classlist says that classList is only usable starting IE10).
It would help to either add the
X-UA-Compatible
meta tag or alternatively a) document what version of IE is supported and b) just display a message if it is too old.(yes, I know it's barely documented that saving as HTA would work, it's only mentioned in this one tiddler): https://github.com/TiddlyWiki/TiddlyWiki/blob/master/content/ServicePack2Problems.tid
I managed to work around this in my copy by manually adding the
X-UA-Compatible
meta tag.