According to Adobe, to use Microsoft Edge as a preview browser in Windows 10, you should do this…
To use Microsoft Edge to preview your web pages, perform the following actions:
- Ensure that Microsoft Edge is configured as the default browser on your Windows machine.
- In Dreamweaver, perform the following actions:
- Go to Edit > Preferences, and click Preview In Browser in the Category list.
- Click + to add a new browser to the list of browsers that appear in the Preview In Browser option.
- In the Add Browser dialog box, specify a friendly name for the browser, for example, Edge. Then, specify C:\Windows\explorer.exe as the path for the application.
- Based on whether you want to use Microsoft Edge as the primary or secondary browser, select the appropriate option.
- Click OK. Then, click Apply to apply the changes and Close to close the Preferences dialog box.
Edge as My Default Browser? No thanks!
I am not okay with setting my default browser to a minimal market-share browser I simply will not use until necessary (eg: cross-browser testing of layouts, CSS and JS). Chances are, you feel the same way.
What I did to get around this issue pretty much the same as Adobe’s suggested step 2, but without setting Edge to my default browser.
Which results in a more favorable solution than changing my system defaults to an undesirable browser.
Now when I select “Edge” from my “Preview in Browser” icon, I am presented with this screen…
It may add a few extra clicks, but I’m willing to do that in order to keep my default browser set to my own preference 😉
Note: Unfortunately that only seems to work the first time Edge is chosen from Dreamweaver’s browser list (subsequent clicks still open with default browser). If I figure out a a way to ensure the “Select an App” Windows prompt shows every time, I’ll post an update. Temporary solution is do not close Edge once it’s opened via preview, just refresh the page 🙄
Things were looking up today when I revisited this issue and decided to take a new approach… command line sledgehammer 😀
I figured out you could execute a batch (.bat) file via the browser list which is not restricted to binary executable files (.exe). The `start` command seemed to be the way to go and `start microsoft-edge:”http://www.robertmullaney.com”` worked like a charm! Next step was to see what Dreamweaver passed to the command line via `ECHO %1 >> dreamweaver-log.txt` and as expected, the quoted path of the document was passed to the BAT file (eg: “C:\Users\[removed]\Sites\test.html”). Now I just had to pass what I wanted to Edge since the filename by itself was not suitable (missing “file:” protocol). So I prepped it in the batch file via `@SET str=%~1` (tilde removes outer quotes) then prepended it with `file:///` before passing it of to MS Edge 🙂
Things were looking good. I had the code I needed to open the app AND pass the prepared filename! When it was all said and done, my batch file executed `start microsoft-edge:”file:///C:\Users\[removed]\Sites\test.html”` and the browser opened… to the default Edge page :think:
I spent more time than I’d care to admit trying to figure out what was wrong assuming I had coded something incorrectly. Every other browser would open the local file fine using the same `start` method, I looked through countless pages that provided mixed information opening local files working or not. :rage:
Ultimately it comes down to Microsoft Edge blocks local files from being opened via the command line (eg: using the `file:` protocol). So, back to the drawing board with the eventual hope that I’ll find some way around this “security” feature (apparently added to save users from themselves; while shooting developers and system admins in the foot) 🙁
Ding ding ding! We have a winner! Though it requires being able to compile C# source 😛
Grab the source of my fork at https://github.com/rmullaney77/edge-launcher
I made a small modification to the RegEx in `static void Main` of `Program.cs` and it works perfectly! See my modifications at https://github.com/rmullaney77/edge-launcher/commit/7a9e07f06f373fc979b4d630b7598774c3363bbd
PS: I did not work on the C++ as I am not familiar enough to modify that code. You can used my forked C# as a baseline if desired 😉
Attempted to modify the C++ code, and yeah… not happening. Maybe once I have enough free time to get up to speed 😛
Adding the path…
C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
…worked for me
Thanks for the feedback. Maybe it will help someone else.
Post was created around Edge’s public release. Leaving original post as-is for historical purposes.
Excellent, thanks for sharing your solution!