Reputation: 1664
Background: I have a readme file which is a .html
file.
I am using _file.openWithDefaultApplication()
to open this up in the browser.
This works perfectly and I thought was foolproof. Problem I have is it seems I have a better fool for a co-worker who was testing my application.
His Windows PC had NO default application set for a .html
file so when he selected a default application, he choosen "notepad".. as you might have guessed, reading a .html in notepad was useless but Windows 8 choosen this as the default from that point onwards.
Question 1 Can I test if the application has a default application, so I can warn someone to open a .html file in a browser.
Question 2 Can I choose to ignore the default application if it is not a browser or somehow remove the default?
Upvotes: 1
Views: 174
Reputation: 1624
I can't find anything that lets you get the path to the browser executable directly. But if you are down with writing a native extension, you can probe the Windows Registry to get the path. Compare it against a known whitelist of popular browsers.
The Registry keys to inspect for a documented at Windows RegKey - Default Browser Application Path and at How to determine the Windows default browser (at the top of the start menu)
Writing native extensions is a bit of a hassle, and I've never written one for Windows desktop. It might be more trouble than you've bargained for.
.p
Upvotes: 2