0

i have very serious problem if any tech expert can help...thank you in advance..

i have below html file on which i dont have any control

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<a href="http://cafebar.ro/home.php" target=_blank><img class="photo" width="100%"     src="http://cityadvertisement.com/Photo-Gadgets/Sportsgirls/photo-102.jpg"></a>
</body>
</html>

now what i want to do is if the above image does't found then it should display default image (i can not update above html file). but on server i can create e404.html page which will be displayed if image is not exist on server but when i run above html page it doesnt display anything... and On my yahoo hosting i dont have .htaccess

can anybody tell me how i can display default image on above html page.

4

2 に答える 2

1

HTML ドキュメントを変更できない場合は、src属性で参照されているサーバー (cityadvertisement.com など) に影響を与えない限り、うまくいきません。重要なのはそのサーバーの応答であり、他の要求に対する他のサーバーのエラー応答ではありません。

そのサーバーにアクセスできる場合は、実際の画像が存在しない場合にhttp://cityadvertisement.com/Photo-Gadgets/Sportsgirls/photo-102.jpgの要求に応答してデフォルトの画像を返すようにする必要があります。HTML (エラー) ドキュメントを返すことは役に立ちません。これは、ブラウザーがイメージを予期し、タグを処理するときに HTML ドキュメントの応答を破棄するためです。img

「e404.html ページを作成する」ことはできるが、.htaccess を使用できないという理由がよくわかりません。これは、サーバーが e404.html を 404 エラーのエラー ドキュメントとして設定する .htaccess を修正したということですか? それからあなたは立ち往生しています、私は恐れています。

于 2012-06-14T14:15:59.073 に答える
0

これが最適な解決策になるかどうかはわかりません...あなたが持っているhtmlページのiframeで新しいページを作成してください。画像が利用可能かどうかを確認するスクリプトを用意し、そうでない場合は実行時に画像の src を変更します。

于 2012-06-18T12:45:41.973 に答える