Tutorial :Programatically preventing Firefox to auto-resize images


By default in Firefox every time you open an image it will re-size to fit within the browser window, now if you view a lot of images this can become annoying having to click on the image every time it loads to see it full size.

There is a way to switch off that in about:config, but this is not a solution for a broader public.

Is there a way to switch that off by some JavaScript function, or CSS, or something else?


If you would like to switch off auto-resizing images in your browser, then you can

  • type about:config
  • search for property browser.enable_automatic_image_resizing
  • and set it to false

If you want it for your visitors, I just can repeat what Jeremy Sydik writes in Design Accessible Web Sites,

it’s just their web, we’re building on it.

And in this case, you really shouldn't decide whether your users want Firefox's auto-resizing feature or not. You can always choose a solution that gives better user experience to your visitors. For instance, you may install a Lightbox variant as Daniel A. White already mentioned.

There is also great_llama's solution to open images inside a HTML page.


Point to a dynamic page that uses an IMG tag with the appropriate source, rather than pointing to the raw image. Use the querystring or something similar to pass the image name to the page.

<html><body><img src="yourimage.jpg"></body></html>  


I dont think there is anyway to change that behavior, at least using javascript or css.

Why not use a jQuery Lightbox? http://leandrovieira.com/projects/jquery/lightbox/


Though I have not tried it, I don't see why it would autosize if you wrapped it in html and not link directly to the image.

if that is an option, just wrap it in html:

<style type="text/css">   * { margin:0; }  </style>  <img src="whatever.jpg" />  


If you are the owner of the image, embed the image in an HTML document. Firefox resizes an image only if you open it directly in the browser.

If you are talking from a Firefox user's point of view, I think about:config is the appropriate place to disable this functionality.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »