Samisite Webmaster Community Forum

SPECIAL TOPICS => Iframes in detail => Topic started by: UK Phil on May 20, 2011, 10:36:33 AM

Title: Webcam in iframes
Post by: hidden on May 20, 2011, 10:36:33 AM
Hi

I am hoping that someone here can help me with an iframe problem that others must have, but no-one seems to know the answer to. Now there's a challenge1!!

As a background I am using Google sites, and have tried a couple of iframe gadgets, and contacted the developers about my problem, but I am getting nowhere.

I am putting a live webcam image in an iframe on my site. I have tried several gadgets, and used safe html bypass to create my own. Any of those options seems to work fine, when the camera is online.

As the camera is being serviced from a PC in my shop, it is only online when the shop is open and the PC is on. What happens, obviously, is that when the camera is offline a page error is displayed in the iframe. I want to trap an offline error and display a saved image rather than have the iframe filled with rubbish.

Has anyone any ideas? The following sample code was suggested, but doesn't work in Google sites.

<html>

<p id="iframe" align="center">
<iframe src='http://localhost:8081/index.html' style='border:none' frameborder='0' width="800" height="600" onError="location.href='offline.jpg'"></iframe>
</p>

<img src="http://localhost:8081/onlinetestimg.jpg" width="1" height="1" style="visibility:hidden" onError="document.getElementById('iframe').innerHTML = '<img src=\'offline.jpg\'>'">

</html>


Thanks
Title: Re: Webcam in iframes
Post by: hidden on June 01, 2011, 08:40:36 PM
There is a SIMPLE solution. Show a statement ALWAYS. Ask your vistor to click a link to see the web cam.
It is not automatic, but it does solve the problem...Tells the visitor time, and keeps iframe from showing error unless your visitor tries to see cam outside operating hours. (Then they deserve an error!)

Here's how:
- Create a clean page, with only a statement that says "This webcam is available during the hours of X-X EST"
- Set your Iframe to point to that page.
- Then beside or under the iframe, set a link to change content that says:  "LOAD WEB CAM"
- Set that link to change the TARGET="iframe1" (or whatever you name the iframe). It will load the web cam in the iframe if it is online.


I do not have an automated answer for you.  Sorry to say that I have played with some code and did not get the result you intend.

Tried simlar to what you posted, then I was wondering if you could define two different pages with iframes.  Have a PHP code on top that checks server time.  If between Xam - Xpm show this page.