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.
Related
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
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.
I'm creating a little project in HTML and there's something that I would like to do.
Imagine that my HTML page is hosted, and you can download there some .ppt and .exe files and place to a specific folder.
Now, that's the problem. Considering that the files are in the right folder, I would like to run these files when the user select their respective options at the HTML page.
Does anyone know how to do it? Thanks :)
This isn't directly possible, for security reasons.
If you control that application or can install something on the user's system, you can associate a file type or URI handler with the application you wish to launch.
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)
So, I'm going through Steven Foote's "Learning How to Program" book and the beginning section has us uploading a manifest.json file to chrome://extensions. Using http://jsonlint.com/, the code seems valid.
When I go to upload the .json file to the extension page, it is unselectable (can't click on the file")
http://i.imgur.com/XbGeTpB.png
Any suggestions?
Thanks.
A manifest JSON file is useless by itself - it describes how to handle the rest of the content in the folder.
Which is why, in fact, you need to select the folder (that contains the manifest) to load as an unpacked extension.
You'll notice that the dialog in your screenshot asks for exactly that and the "Select" button is active even though you haven't selected any files. You're in the target directory and there's nothing extra you need to do.
And if, later, you publish to CWS, you'll need to provide a zip of your extension folder.