Monday, June 30, 2014

Multiple Browsers

There are times that you have to test your local Visual Studio project in multiple browsers while developing. To accomplish this, many developers follow the following few steps:

  1. Start their project with their default browser by selecting Debug -> Start Without Debugging
  2. Copy the URL from the address bar in the newly opened browser.
  3. Open each other non-default browser individually and then paste the location in each browser.

These three steps are not too time consuming, but it does force you to take each step and also allows you to decide when to test in all browsers you support.  Most of the time, the tendency is to just forget about the non-default browsers until the very end which is never a good idea.

I am going to demonstrate a way to set Visual Studio to open multiple browsers each time you use Start Without Debugging.

1.   Open a web site or web application in Visual Studio 2012 or 2013.

2.   Select the little dropdown next to your default browser.





   












3.   Select the option named Browse With ... This will open a dialogue that allows you to set a default browser.

4.   Use the Ctrl key to select two or more browsers as I did in the screenshot displayed , then click the Set as Default button.




















5.   Close the dialogue by clicking the Exit button in the upper right corner.

Take a look at where your default browser is usually listed and you will see Multiple Browsers is now displayed.





The above steps will make two changes to what happens when you run your website in Visual Studio.

Start Without Debugging - This option will automatically launch all of your default browsers.  This is a timesaver when you have to constantly check your work in multiple browsers after a change.  It also will be a reminder that there are other browsers out there besides your favorite that you need to verify before it gets too late in the development process.

Start Debugging - This option will open a dialogue that will allow you to select a browser to use for that debug session.  In this case, I am presented with Firefox and Google Chrome because they are the two browsers I selected as my default in step #4 above.  The reason that it won't fire up multiple browsers at once is because in this case, you would be Debugging.













This Visual Studio feature is one of those features that will benefit some, but will be something that will be stored in memory for future use for others.  Either way, it is a nice little feature to know about.

peace yo!