Scenario: I'm using IFRAME in my home page.
If I shutdown Yawcam, the IFRAME will display a blank page "404 ERROR-PAGE NOT FOUND".
I want to redirect only the IFRAME content(yawcam page) to another content located in my webhost(an offline image).
I can do this using the script below, but it's PHP and I'm looking for something that's work in HTML pages. I can convert my page from HTML to PHP, but this will broken my links to this page.
Can javascript handle IFRAME redirections?
Code for PHP 5.3 pages (maybe works in PHP 5.2):
Code: Select all
<?php
ini_set('default_socket_timeout', 10);
$checkOnline = @file_get_contents("http://public_ip_adress:8081/just_dummy_small_file_located_in_stream_folder.txt");
if ($checkOnline) {
echo '<iframe src="http://public_ip_adress:8081" frameborder="no" scrolling="no" border="0" marginwidth="0" marginheight="0" hspace="0" style="width: 640px; height: 480px;"></iframe>';
}
else {
echo '<img src="offline.jpg">';
}
?>