Showing posts with label FireFox. Show all posts
Showing posts with label FireFox. Show all posts

Monday, August 11, 2008

When do browsers download images defined in Cascading Style Sheets?

Just the other day I was talking with a coworker about ASP.NET Themes. We were addressing a question about putting multiple Cascading Style Sheets (CSS) into a theme.

Unless you do something special, ASP.NET Themes adds a link reference to every CSS file in the theme directory. We were fine with this behavior even if the styles weren't used by the page, but what about all the background images defined in the style sheets?

Here's where we asked the question "When do browsers download images defined in Cascading Style Sheets?"

Here are my findings:

Both Internet Explorer 7 and FireFox 3.0 do not download an image unless the style is used on an element of the page.

For Example:

Consider a style sheet called style.css which containes

.image
{
 background:transparent url(testImage.png);
}

If you have a html file which contains:

<html>
    <head>
        <link type="text/css" rel="stylesheet" media="screen, projection" href="style.css">
    </head>
    <body>
        <p>Hello World</p>
    </body>
</html>

There will be two requests to the server: html, and css

If you have a html file which contains:

<html>
    <head>
        <link type="text/css" rel="stylesheet" media="screen, projection" href="style.css">
    </head>
    <body class="image">
        <p>Hello World</p>
    </body>
</html>

There will be three requests to the server: html, css, and png

I tested using FireFox 3.0 with FireBug (HEH HEH, FIRE!), and Internet Explorer 7 and Fiddler.

Monday, April 23, 2007

Using Firefox for ASP.NET Development

Introduction Aside from Visual Studio, FireFox is my most valuable tool when it comes to web development. Over the past couple of years I've come across a few extensions that I find very useful. So with this post, I wanted to take a moment and share with you the FireFox add-ons every .NET developer needs. The .NET Essentials FFClickOnce If you ever plan on programming smart client applications which use ClickOnce deployment, this is a needed add-on. Without it ClickOnce installation through Firefox is nearly impossible. IdentitySelector For those looking to implement CardSpace into their website this is an nice add-on to have. It allows Firefox to load the CardSpace Manager for websites requesting CardSpace identification. Web Developer Essentials Web Developer Tool Bar A fantastic tool for manipulating browser features to test or debug web pages. Want to change a cookie? Sure! Disable Javascript? No problem! Resize the browser window to be 800 x 600? You got it! I'm just scratching the surface, with the WebDev Tool Bar you can force your browser to behave almost anyway you want it to. Selenium IDE A great tool for creating automated scripts to test your web interface. The concept is very similar to Watir. However, I prefer selenium because the test files can be used to test "most browsers".
  • Windows:
    • Internet Explorer 6.0
    • FireFox 0.8 to 1.5
    • Mozilla Suite 1.6+, 1.7+
    • Seamonkey 1.0
    • Opera 8
  • Mac OS X:
    • Safari 1.3+
    • FireFox 0.8 to 1.5
    • Camino 1.0a1
    • Mozilla Suite 1.6+, 1.7+
    • Seamonkey 1.0
  • Linux:
    • FireFox 0.8 to 1.5
    • Mozilla Suite 1.6+, 1.7+
    • Konqueror
You can also convert them to C# and run them as unit tests with NUnit. FireFTP When it comes to publishing files, FTP is our tool. FireFTP is a FTP client which lives in the FireFox browser. Easy to install, update, and remove. Which is more then I can say for some FTP clients I've used in the past. Web Designer Essentials FireBug With FireBug I don't know where to start. There is just so much involved, Firebug deserves it's own post. Right now, the best I can do is list some of the features I find most valuable
  • JavaScript debugging and profiling
  • Real time HTML and inspecting and editing
  • CSS manipulation and measuring
  • DOM inspection
  • Network Activity Monitoring (Not to the power of Fiddler, but acceptable)
I praise the features of Firebug daily. Firebug and the the Web Developer Tool Bar have some similar functions, but the two compliment each other very nicely. ColorZilla Is a great little tool to grab both RGB and HEX colors from any web page to you clipboard in a few mouse clicks. It also has page zoom capabilities and a handy color picker too.
MearsureIt A tool to quickly measure pixels on a web page. I use this tool when I'm making images to fit perfectly within containers (div's) on my websites. IE Tab With this add-on I almost never fire up IExplore.exe. You really don't have a need when you can load the IE engine right in a FireFox tab. Let's face it, some Javascript, and CSS behave differently in IE . We as web developers, at a minimum, should test on both platforms. You can also customize it to always open certain pages in the IE engine. I like to use it to force office files to load as embedded files in separate tabs. You just add rules like *.doc and no more "What would you like to open this file with?" dialogs. Summary I urge everyone to try one or two of my suggestions. I didn't give them much justice with you compare it to the power you get. Please feel free to comment or list other tool you find to be helpful. I learned about all the above from other people's comments, what more can I learn from you? Can we all learn from each other?