cbeyls / slimbox

The ultimate lightweight Lightbox clone
http://www.digitalia.be/software/slimbox2
50 stars 24 forks source link

image URL error handling #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
In the attached source file:
1. change activeURL in the errorLoadingImage() function to a relevant path 
of an existing image.
In the application
2. Init slimbox with an image set containing several incorrect image URLs 
in a row.

What is the expected output? What do you see instead?

This function should produce a default image when the expected URL fails, 
however the default error image will not always be displayed, as the 
lbImage div  is not getting its visibility style set to ""

What version of the product are you using? On what operating system?
Slimbox2, jquery 1.3.2, firefox and chrome on Win XP SP3 

Please provide any additional information below.

I know you didn't write this script and I am not a javascript developer but 
I thought it would make a good feature and I didn't expect the problem.

Original issue reported on code.google.com by johnschram@gmail.com on 9 Apr 2009 at 8:27

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I fixed the issue by adding 
"?" + Math.random();
to the error image URL

Original comment by johnschram@gmail.com on 9 Apr 2009 at 9:04

Attachments:

GoogleCodeExporter commented 9 years ago
Slimbox has no "error handling" function. Thank you for providing a fix for 
those who
are using this custom script anyway.

In my opinion, there should not be any error handling in slimbox because the 
"error"
is a human error caused by the web designer, so it's the responsibility of the 
web
designer to use correct URLs. Adding error handling would need to make the code 
much
bigger and complex and the benefit is very small. For me, invalid URLs are like
javascript syntax errors or missing javascript files: when it's wrong, it just
crashes and the web designer/coder needs to fix it. As long as the web designer 
uses
correct URLs, all should be fine.

Original comment by christophe.beyls@gmail.com on 16 Nov 2009 at 4:10