Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: HTML
Hi all
 
I have connected to my IP camera, but I have to press f5 to refresh it. Is there any way to refresh the camera image by itself. I don't want to refresh the hole webpage.
 
Thank you
 
Jimmy
Posted 13-Feb-13 12:26pm
Comments
richcb at 13-Feb-13 17:27pm
   
You could use AJAX and do asynchronous postbacks to refresh a certain part of the page.
AspDotNetDev at 13-Feb-13 18:01pm
   
How are you currently adding the image to the page? If it's a constant filename, such as "\\ip_camera\image.jpeg", you could just use JavaScript to keep changing the query string, such as "\\ip_camera\image.jpeg?version=88".
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hello,
 
You can ask the browser to automatically refresh your page using the Meta tag in the head section.
 
<!DOCTYPE html>
<html>
    <head>
        <META HTTP-EQUIV="REFRESH" CONTENT="1">
    </head>
    <body>
        what ever you had before
    </body>
</html>
 
The value of CONTENT is the number of seconds for the auto refresh.
 
Valery.
  Permalink  
Comments
Member 9655777 at 13-Feb-13 19:55pm
   
I tried it before, but it is refresh the whole webpage. I just need to refresh the image, like streaming image.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Place your image content inside Ajax UpdatePanel. And use Ajax timer to refresh the same content for regular interval of time.
 
Ex:
<asp:ScriptManager runat="server" ID="ScriptManager1" />
        <asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick">
        </asp:Timer>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
            </Triggers>
            <ContentTemplate>
                <asp:Label ID="Label1" runat="server"></asp:Label>
            </ContentTemplate>
        </asp:UpdatePanel>
c# code below..
protected void Timer1_Tick(object sender, EventArgs e)
    {
        Label1.Text = DateTime.Now.ToShortTimeString().ToString();
    }
 
Above code will fetch current time for regular interval of 1 second. You place your code inside update panel and give time as much you wanted to refresh the content..
..
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

To refresh the image but not refresh the whole webpage.
<img src="url " id="reloader" onload="setTimeout('document.getElementById(\'reloader\').src=\'url\'+new Date().getMilliseconds()', 500)" />
 
url is link of the source.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 390
1 Sergey Alexandrovich Kryukov 329
2 Afzaal Ahmad Zeeshan 244
3 BillWoodruff 210
4 Maciej Los 192
0 OriginalGriff 5,560
1 DamithSL 4,476
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 16 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100