views:

282

answers:

5

Hello,

Here's an easy question. How do I configure Visual Studio 2008 to build my webpage in a certain browser? I really want to build in all 5 well-known browsers (IE, Firefox, Chrome, Opera, and Safari), but right now I am having to right click the actual html files and open them in different browsers. In dreamweaver, there is a simple dropdownlist for this...what does visual studio have?

+1  A: 

See this page for switching the default browser. As far as a dropdown to easily switch like Dreamweaver, there may be a plugin.

patricksweeney
+1  A: 

Right Click on an Aspx page, choose "Browse With...", and set Firefox as Default.

DeskCoder
+8  A: 

Firsty, you don't build your site for each different web browser. You build one website that's standards-compliant and will work in all browsers.

Having said that, you will probably have to use some non-standard "hacks" to get Internet Explorer to behave as the other browsers do because older versions of IE don't follow web standards.

You should setup your website in IIS using IIS Manager. Then you can run your website in whatever browser you like using a URL like http://localhost/YourWebsite/

Here's an article on creating a website in IIS: http://support.microsoft.com/kb/323972

Alternatively if you want to use the web server that's built into Visual Studio you can right-click one of the pages in your project, select Browse with.. and use the Browse With dialog to set the default browser. Once you've done this you can run your site in the default browser by pressing F5.

BFOT
You can avoid a lot of hacks by figuring out what exactly will break a browser. For example, I try to avoid putting both padding and margins on the same element. Just nest an extra div to get the same effect, and you might not need a hack.
Mark
Of course I'm not actually branching my code for each browser. Most of this info is beyond the question, but I'm sure it will help others. The Browse With... was what I was looking for, and the problem is no longer.
TahoeWolverine
This question gives How To on changing default browser in Visual Studio - http://stackoverflow.com/questions/297298/how-to-change-the-default-browser-to-debug-in-visual-studio-2008
Paul Rowland
A: 

I like the site browsershots.org, submit your URL and it shows how it looks in different browsers on different operating systems. After a minute or 2 I got back 42 different shots.... good to know I look good on FireFox 3.0.4 on MAC OS X 10.6 :).

JBrooks
This only works well if your site is exposable to the browsershots crawler, which may not work well for sites that aren't ready to be crawled, such as embryonic initial dev.
John Dunagan