Browse Source

Fix double request from an empty img:src attribute

Some older browsers perform a second HTTP request to the window location when an empty img:src attribute is encountered. This causes some performance issues and can lead to unwanted code execution. Adding a small data URI fixes this issue for older versions of Safari and Firefox.
master
Mike Almond 6 years ago
parent
commit
c17da5258c
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      coffee/lightbox.coffee

+ 1
- 1
coffee/lightbox.coffee View File

@@ -52,7 +52,7 @@ class Lightbox
# Build html for the lightbox and the overlay.
# Attach event handlers to the new DOM elements. click click click
build: ->
$("<div id='lightboxOverlay' class='lightboxOverlay'></div><div id='lightbox' class='lightbox'><div class='lb-outerContainer'><div class='lb-container'><img class='lb-image' src='' /><div class='lb-nav'><a class='lb-prev' href='' ></a><a class='lb-next' href='' ></a></div><div class='lb-loader'><a class='lb-cancel'></a></div></div></div><div class='lb-dataContainer'><div class='lb-data'><div class='lb-details'><span class='lb-caption'></span><span class='lb-number'></span></div><div class='lb-closeContainer'><a class='lb-close'></a></div></div></div></div>").appendTo($('body'));
$("<div id='lightboxOverlay' class='lightboxOverlay'></div><div id='lightbox' class='lightbox'><div class='lb-outerContainer'><div class='lb-container'><img class='lb-image' src='data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=' /><div class='lb-nav'><a class='lb-prev' href='' ></a><a class='lb-next' href='' ></a></div><div class='lb-loader'><a class='lb-cancel'></a></div></div></div><div class='lb-dataContainer'><div class='lb-data'><div class='lb-details'><span class='lb-caption'></span><span class='lb-number'></span></div><div class='lb-closeContainer'><a class='lb-close'></a></div></div></div></div>").appendTo($('body'));

# Cache jQuery objects
@$lightbox = $('#lightbox')


Loading…
Cancel
Save