Image fix and linkify

By Crend King Last update Aug 5, 2012 — Installed 8,031 times.

Script Summary: Show and reload broken images, and linkify images.

Version: 1.3.3

Firefox does not show placeholder for a broken or missing image, instead, it relies on the "alt" attribute to give alternative messages when the image is not available. This is a requirement for XHTML 1.0 Transitional doctype. Unfortunately, many images do not follow this rule, and people may not even know there is a image in the page. Sometimes, the server of the image is just temporarily unavailable due to heavy load, and the service is restored in several seconds. It is an unpleasant experience to reload the whole web page just for one missing image.

This script replaces every broken image with the Firefox default broken icon (resource://gre/res/broken-image.gif), and does nothing for good images. User can use the Greasemonkey user menu to inform the script to reload all missing images. This script also skips the images which have their own error-handling functions.

You can replace the broken icon with any image you want by assigning the broken_icon variable to a vaild URI. It can be a URL starting with "http://", or the data URL scheme such as "data:image/png;base64,< data >". Please refer this page for more information about the data URL scheme.

This script has the ability to linkify unclickable images by adding onclick event to the img nodes. If the image is originally clickable, the script skips. This feature is useful if the image is explicitly reduced and user wants to view the original size.


Open the source code to change these options:

  • use_fail_safe: set this to "true" if you want to show and reload broken images . disable with "false". (default true)
  • do_linkify: set this to "true" if you want to linkify unclickable images. (default true)
  • link_in_new_tab: when linkification is enabled, set this to "true" to link the images in a new tab. (default true)
  • link_force_no_border: when linkification is enabled, set this to "true" if you do not like border around images. (default true)
  • min_dimension: if the width OR the height of an img node is smaller than this value, it will be skipped in the fail safe function. However, if the image itself is tiny, this option will not take effect. (default 10 pixels)
  • key_shortcut: use this option to enable/disable keyboard shortcut (alt+r). (default enabled)

Please open the script file to change the options.

Known issue

This script has compatibility issue with imageLoader. Bad image links will be rendered as the broken icon if this script is executed after imageLoader. Please move this script to somewhere BEFORE imageLoader in the Greasemonkey script management window.


If you just want to show broken images, you can try the following CSS:

@namespace url(;

@-moz-document url-prefix(http), url-prefix(https), url-prefix(file) {
    -moz-force-broken-image-icon: 1 !important;
    width: 24px;
    height: 24px;

Use it with userContent.css or Stylish. There are existing Stylish items, such as Show broken image placeholders or Show Broken Images.

Test area:

Please switch this script on and off to see difference.

Normal plain image:
Image originally with link:
There is an invalid image after the colon: < -- can you see it?

Version history

1.3.3 on 04/22/2009:
- Add keyboard shortcut option (alt+r).

1.3.2 on 04/15/2009:
- Add option to skip tiny img nodes in fail safe function.

1.3.1 on 04/14/2009:
- Fix bug in reload function.

1.3 on 04/11/2009:
- Refactor fail safe code for higher compatibility.

1.2.6 on 04/09/2009:
- Fix XPath bug in 1.2.5.
- Ignore images with no src attribute for linkification

1.2.5 on 04/07/2009:
- Ignore images with no src attribute for fail safe.

1.2.4 on 03/30/2009:
- Fix fail safe bug in version 1.2.3.

1.2.3 on 03/26/2009:
- Use onclick instead of hyperlink to linkify images.

1.2.2 on 03/16/2009:
- Fix false linkification on image nodes who have onclick event.

1.2.1 on 03/14/2009:
- Only linkify images whose ancestor nodes are not anchors or have onclick event.

1.2 on 03/13/2009:
- Rewrite the script with XPath, simplify code (Thanks cDkPAEz for suggestion).
- Add option to force no border for linked images.
- Fix one-level onclick event problem.

1.1 on 05/18/2008:
- Rewrote the script to support Firefox 3.

1.0.2 on 05/07/2008:
- Added "Reload missing images" function (Greasemonkey user script menu).

1.0.1 on 03/30/2008:
- Fixed problem when an image is assigned some events, such as onClick or onMouseDown. This problem may cause some script-based pages malfunction.

1.0 on 03/14/2008:
- This script is incompatible with Windows Live Hotmail. I added it in the exclude list. If you find any other incompatible site, please tell me. Thank you!