mozdev.org

viewbgplus

resources:

View Background Plus (viewbgplus) is a Firefox extension that extends the built-in ability to view the background image of a webpage. (Note: It was developed for and tested with Firefox, but uses nothing Firefox-specific, so it should run with Mozilla as well).

By default, Mozilla/Firefox is only able to show the "main" background image (which is set in the <BODY> tag). But background images can be set in almost any HTML tag, either through HTML attributes ("background=file.ext") or CSS (style="background-image:url(file.ext)").

The idea to this came from the Internet Movie Database, which in its image galleries uses a cunning way to prevent people from easily saving their images:
Instead of just putting the image in an <IMG> tag, they do something like this:

<TABLE background="http://domain/path/image">
<TR><TD><IMG src="mptv1.gif" height=x width=y ...></TD></TR>
</TABLE>

mptv1.gif is a 1x1 image (let's rather call it a dot ;), x and y are the true dimensions of the actual image.

So when the user tries "View image" from his context menu, he will just get the dot, whereas "View background image" is disabled, as the page has no overall background.

View Background Plus solves this by replacing the built-in "View Background Image" context menu entry and adding a direct "Save Background Image" entry. This works with _any_ background image. It does so by checking the current element (i.e. the one the mouse cursor's pointing at) and its parents (up to <HTML>) until it finds a background image (either CSS or standard HTML) or none at all. Depending on the setting, the image is opened in a new window, new tab or the current tab.

Additionally, the extension features a quicksave command, i.e. you only have to choose the destination directory once, after that "Quicksave Background Image" will save the image to that directory without further dialogs and mouse-clicks. And as a bonus, quicksave is also available for "normal" images, i.e. <IMG> tags (although this feature doesn't really fit into an extension called View _Background_ Plus - but the code was almost the same and it is just too useful to only add for background images :).

The viewbgplus project can be contacted through the mailing list or the member list.
Copyright © 2000-2009. All rights reserved. Terms of Use & Privacy Policy.