Dead image link

In any case, it’s better to prepare for the accidental error. For example, dead image link in the campaign.

It can be happen when you use image from Global, or Account, and some other designer accidentally deletes the file from there. Then you will never know that dead image link appeared in your campaign.

This is very simple and useful jQuery to replace dead link image.

Missing Image file


$(function () {
$('img').error(function(){
$(this).attr({src:'http://YourDomain/.../Missing.png',alt:'Image file is missing'});
});
});

The src link have to be absolute URL path.
If you’d like to use uploaded image for it, try to place it in actual page, then check the file path from HTML code by displaying page preview. So you can copy the file path, and use it as alternative image file for this function.

 

Thank you for Mana, who is introducing very nice tips for web creator!
You can find more and more useful tips in her blog.

広告

コメントを残す

以下に詳細を記入するか、アイコンをクリックしてログインしてください。

WordPress.com ロゴ

WordPress.com アカウントを使ってコメントしています。 ログアウト /  変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト /  変更 )

%s と連携中