It seems that youâve found a problem that windows has with dot files, which are a common feature of linux. Iâm not aware of any solution, other than to leave a reminder such as âremoveBeforeSaving.htaccessâ
In the âSave asâ dropdown area, change the text file to instead say âAll filesâ. It will then accept whichever file name you provide without forcing it to be a text file.
which results in the file type of the save dialog box being .htaccess, from where you can then remove the removeThisPart of the filename in the save dialog box, before continuing on to save the .htaccess file.
Itâs not as easy as what you desire, but thatâs due to a limitation of windows.
If instead you change to using Linux, then you will have no problem with .htaccess as thatâs native to the unix-based operating system that you will then be using.
Thanks for the detailed explanation. My script does not create a save dialog where you can edit the file name (is that possible?) so I guess that will not work for me.
EDIT: Sorry, it seems a browser setting I disabled earlier, I see the save dialog now on Chrome and Firefox. Thank you again, I will use your solution as it is really close to what I needed.
Have you tried surrounding the filename in quotes - thatâs the usual way to force windows to accept the filename as is without it trying to add an extension or remove the leading dot.
You could try escaping with backslashes. But I fear this is likely impossible to do with JavaScript.
Windows has tight security for some things, even to the point where certain actions need to be ârun as administratorâ
Yes, windows does make some things like this quite tricky. It looks like the closest solution so far is to add filename text that is to be removed when at the save dialog box: