|
|||||||
| Shooting The Shit This is where the action is for all webmasters alike. Anything goes, seriously. Come meet and network with your peers, it's a fun way to take a break out of your busy day of posting at other boring forums. |
|
Welcome to the WickedFire - Affiliate Marketing Forum - Internet Marketing Webmaster SEO Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Pwner.
|
Alright party people. Here's the pop quiz for today (because I need help).
Is there a way, in Javascript, cross-browser compatible, to detect a broken image on a page, and replace it with a "image not found" placeholder?
__________________
"If you ain't first you're last..." ... "Oh hell, Son, I was high that day. That doesn't make any sense at all, you can be second, third, fourth... hell you can even be fifth." |
|
|
|
|
#2 (permalink) |
![]() |
okay strictly speaking, you would need to read the return headers to see if it's a 404 -- but I have no idea if Javascript allows you to read headers
there is a workaround however - you can create an xmlHTTPrequest object and use it to request a PHP code to run the file_exists function -- but this isn't very fast or efficient you're better off checking for the problem using PHP while the page is still loading, as opposed to using Javscript PS: I'm not a JS guru so wait for more replies before you decide
__________________
@soluh |
|
|
|
|
#3 (permalink) |
|
Pwner.
|
It's ASP... Hmmm... I guess I can do a server-side file request, but that might require a lot of processing on the server side. I'd prefer to do it client side if I could. I was hoping there was some quick jscript shortcut to make this happen.
__________________
"If you ain't first you're last..." ... "Oh hell, Son, I was high that day. That doesn't make any sense at all, you can be second, third, fourth... hell you can even be fifth." |
|
|
|
|
#5 (permalink) | |
![]() |
Quote:
maybe you can setup a cron job to periodically check which images exist on the server I'm not sure whether or not you're the same guy but does this have something to do with website screenshots?
__________________
@soluh |
|
|
|
|
|
#6 (permalink) |
|
Domainers...
|
I would time it. I know when RSnake or someone came up with a portscanner with/without javascript, they timed how long it took for a request to complete, to see if a server existed on that IP/port. I'm sure you could do the same for an image. Just setTimeout();
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|