Local HTML files not opening properly - html

I'm having an issue with a local .HTML file.
Everytime I try opening it on ANY browser and on ANY computer it does not work, it opens normally for a brief second and then I get the screen saying the file path could not be found. If I spam refresh fast enough I can read the first lines.
The .HTML file has been extracted from a .war file.
If I copy the code into a new file and open that one, it opens up nicely.
The weird that got my attention was the path for the files themselves on the browser
The one directly extracted from the .war file is as follows:
file:///C:/Users/username/Desktop/New%20folder/help/User_Guide.html?1userhelp.html
but there is no file "User_guide.html" on the folder
If I create the same file just under the desktop directory it opens up without problems, so the issue is not the content of the file itself.
Does anyone have an Idea to what may be causing this problem?

As suggested by SunnyPatel
We aren't sure which OS you are using, and so case-sensitivity may play a part in this. If you're on Windows, you can try viewing the parent folder in the browser, and see if you can click on the file within the default index page and open it from there
Opening the file by first going into "/index.html" worked just fine. The whole navigation flows perfectly, the issue was just me trying to open the file directly.

Related

Code to set default browser in html file

I've created a file in HTML and would like to set a default browser to have this load from. Can this be done using HTML, or does javascript have to be added to do so?
You can do that locally as part of a shortcut. So right click in desktop> create new shortcut and you can put the path to the browser followed by the html path.
Try this in the target of the shortcut
"C:\Program Files\Internet Explorer\iexplore.exe" C:\Users\user\Desktop\1.html
There will be no other way to start a local program from HTML or JavaScript on the users computer.
To add to SANM2009's answer: you can't set the default browser via HTML or JavaScript, as this would be a huge security flaw that could be exploited to allow malicious code to be set to run when loading HTML files (with even further potential repercussions).
SANM2009's answer is the most direct way to accomplish what you want to do if you only need to do this on your local computer. If you need to distribute your solution then you could use a batch file or PowerShell file to open a specific browser.
To create a batch file, just open a text editor and enter the following (this will open Firefox in this case):
start "firefox.exe" "path to your html file goes here"
Save that as a file with a .bat extension, such as openmyhtml.bat, and then you can just double click that file to open your HTML file in Firefox.
To accomplish the same in PowerShell, open a text editor and enter the following:
Start-Process "firefox.exe" "path to your html file goes here"
Save that with a .ps1 extension, such as openmyhtml.ps1, and then you can double-click that.
Batch files are more universally supported, so that's probably your best bet, unless there's a specific reason you'd want to use PowerShell.
After further investigating the file, when opening the shortcut it showed the incorrect path to the file in the browser. I dropped the file in chrome directly to see the path is detected and set that in the target. It is now working. Thank you both

How does Windows link HTML files to folders?

Almost every time you save a web page from a web browser to your local computer a PAGENAME.html (or .htm) file is created and a folder named 'PAGENAME_files' that contains resources specific to that page.
If you copy/move/delete either the folder or the .html file Windows automatically does the same operation the other file as well.
This behaviour also happens if you create a file named 1.html and a folder called 1_files.
How does this link happen? And why does it work only with web files?
This is a shell feature, not a file system feature. The shell copy engine just looks for a folder with the same name (plus a localized suffix) when copying/moving .htm[l] files.
This feature is called Connected Files and is documented here.
It's a built-in linkage in Windows.
Open up Explorer (not IE, Windows), Tools, Options, View, then in Advanced Settings there'll be a "Managing pairs of Web pages and folders" section.
If people are stuck and ended up here to find how to unlink, here's an easy trick : on Windows 10, I couldn't find how to unlink a .html file from its associated media folder, so I deleted both of them, and in the bin I restored only the .html file and it was then restored and unlinked from its folder.
It is a good question.
Under Windows 7 I managed to solve forced links by simply renaming the file.
I think it is the easiest way.

How to prevent WebStorm IDE from opening '.html' files in a web browser on double-clicking it?

I am trying to name a HTML file as index.html in the WebStorm IDE. However, I am unable to open this file to edit it if I name it index - it directly opens in the browser.
I can open other .html files in WebStorm for editing if they are named something other than index.html.
If I go to Refactor > Rename and change the name of index.html file to something else, I am again not able to edit it.
It seems like there must be a setting for this somewhere but I cannot figure out what or where.
Most likely you have told IDE to open it like that in the past (on purpose or by mistake) .. so it keeps doing it.
Settings/Preferences | Editor | File Types
Find Files Opened in Associated Application entry in top list
Find and remove offending entry from bottom list (most likely will be index.html or similar)

Display HTML file in browser when an EXE file is executed

I have found a lot of answers on how to do the exact opposite of what I'm looking to do, but nothing really on what I'm trying to do.
I have an EXE file that I want to use to open an HTML file in the user's browser as soon as it is executed.
I have two files in the EXE - autorun.inf and index.html. The index.html is what I want to open.
In autorun.inf I have:
[autorun]
open=index.html
All this does is open an error box that says "Installation Failed".
You don't say what language you are writing the .exe in. The easiest thing to do would be to have that program launch the html file. For example, in VB/C# you would add the following inside your main method:
System.Diagnostics.Process.Start("pathtohtmlfile.html");
No need to do anything in the autorun.inf file.

chm viewer unable to show contents

I have a chm file that I can open at home. I use windows XP at home and at work. However, when I open the file at work it doesn't show the contents of the file. It properly shows the TOC for the file though. Any ideas pls?
Try to right-click on your chm file and select properties. You will see an "Unblock" button. Click on it, it should solve your problem.
Other than what Nicolas suggested, you may not be able to see contents of a CHM that you open over a UNC path. If that is the case copy the file to a local drive.
just go to power shell and run it as administrator,
cd your folder
and use the following command
Unblock-File '.\filename.chm'
On Windows 7 copying the file locally and unchecking the file opening warning message worked.
I had the same situation, on a Windows 10 (VMware) system. I had to move the file to a local drive as suggested by another poster AND THEN uncheck the file opening warning message. Opening the file gave a "Open File - Security Warning" message, with a checkbox at the bottom "Always ask before opening this file". Until I unchecked that box, only the TOC showed. After unchecking, the contents showed properly. HTH someone else!
Open command prompt and run as administrator.
Go to file location, input the file name and press enter.
It should open the file and view contents in chm viewer.
More read at: http://langbasics.blogspot.in/2014/12/chm-viewer-unable-to-show-contents.html
Thanks
It appears a lot of people have this problem but were unable to track down a solution. There are apparently different levels of authentication. Most articles I read tell you to set the MaxAllowedZone to '1' which means that local machine zone and intranet zone are allowed but '4' allows access for 'all' zones.
For more info, read this article:
https://support.microsoft.com/en-us/kb/892675
This is how my registry looks (I wasn't sure it would work with the wild cards but it seems to work for me):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
"MaxAllowedZone"=dword:00000004
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
"UrlAllowList"="\\\\<network_path_root>;\\\\<network_path_root>\*;\\ies-inc.local;http://www.*;http://*;https://www.*;https://*;"
As an additional note, weirdly the "UrlAllowList" key was required to make this work on another PC but not my test one. It's probably not required at all but when I added it, it fixed the problem. The user may have not closed the original file or something like that. So just a consideration. I suggest try the least and test it, then add if needed. Once you confirm, you can deploy if needed. If the 'Unblock' method does not work, or you do not see the option, this should. Good Luck!
P.S. Another method that worked was mapping the path to the network locally by using mklink /d (symbolic linking in Windows 7 or newer) but mapping a network drive letter (Z: for testing) did not work. Just food for thought and I did not have to 'Unblock' any files. Also the accepted 'Solution' did not resolve the issue for me.
Your CHM File Has the "#" Hash Character in the Filename or in the Directory Name. Please remove "#" and you will be able to see the content. If still you are not able to see then please visit following link: https://www.helpsmith.com/chm-cannot-be-displayed.php
Windows block *.chm files came from another computer fore security reason. Click right mouse button on file and set unblock checkbox see.
If someone need, there is a web page: http://topdf.com/ where is possible convert a chm in to pdf. I tested it with a chm of ~18MB and 615 pages. I was able to got a pdf with a hyperlinked contents table.
I was experiencing the same problem.
I read that the .chm file only worked on NTFS.
My file was on a cloud network drive which is not NTFS, so I copied it locally and the problem was gone.
Use SumatraPDF. It opens .chm files.
I had same problem and zipped the file then open it from inside the zip program.(I use 7-zip)