School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,489 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,810 people online right now. Registration is fast and FREE... Join Now!




iFrame AutoRefresh

 

iFrame AutoRefresh

hframe

17 Jun, 2009 - 01:52 AM
Post #1

New D.I.C Head
*

Joined: 17 Jun, 2009
Posts: 1

Hi,

I am sorry, I am really quite new to this.


I use a website that I need to log into every 30 minutes if the page is left idle.

I thought I would create an iFrame page that auto refreshed meaning the site shouldn't time out.

My problem is that there are a few different systems on the page with different URLs.

The code I have written seems to only allow me to refresh the page to a specific URL.

Is it possible to tell the code to refresh the current page rather than a specific page?


Currently my code is:
CODE

<html>
<body>
<script type=text/javascript>
  function refresh()
  {
    document.all.iframe1.src = document.all.iframe1.src;
  }
  window.setInterval("refresh()",1440000);
</script>
      
<iframe name='iframe1' src='http://www.mywebpage.com' width="80%" height="800">
  <p>Your browser does not support iframes.</p>
></iframe>
</body>
</html>



Thanks,

Harrison

User is offlineProfile CardPM
+Quote Post


noorahmad

RE: IFrame AutoRefresh

17 Jun, 2009 - 02:23 AM
Post #2

Webmaster
Group Icon

Joined: 12 Mar, 2009
Posts: 2,018



Thanked: 125 times
Dream Kudos: 1350
My Contributions
here is the code
HTML
<html>
<body>
<script type=text/javascript>
function refresh()
{
document.all.iframe1.src = "http://www.google.com";
}
window.setInterval("refresh()",5000);

</script>
<iframe name='iframe1' src="http://localhost/" width="80%" height="800">
<p>Your browser does not support iframes.</p>
></iframe>
</body>
</html>


hope it helps you.
User is offlineProfile CardPM
+Quote Post

JayFCox

RE: IFrame AutoRefresh

18 Jun, 2009 - 05:37 PM
Post #3

New D.I.C Head
*

Joined: 31 May, 2009
Posts: 41



Thanked: 5 times
My Contributions
QUOTE(hframe @ 17 Jun, 2009 - 01:52 AM) *

Hi,

I am sorry, I am really quite new to this.


I use a website that I need to log into every 30 minutes if the page is left idle.

I thought I would create an iFrame page that auto refreshed meaning the site shouldn't time out.

My problem is that there are a few different systems on the page with different URLs.

The code I have written seems to only allow me to refresh the page to a specific URL.

Is it possible to tell the code to refresh the current page rather than a specific page?


Currently my code is:
CODE

<html>
<body>
<script type=text/javascript>
  function refresh()
  {
    document.all.iframe1.src = document.all.iframe1.src;
  }
  window.setInterval("refresh()",1440000);
</script>
      
<iframe name='iframe1' src='http://www.mywebpage.com' width="80%" height="800">
  <p>Your browser does not support iframes.</p>
></iframe>
</body>
</html>



Thanks,

Harrison


Dumb question, but if the issue is that you are trying to keep someone logged in, shouldn't you adjust the timeout? Those timeouts exist for a reasion.

BTW, while the above should work for refreshing (well in IE anyway... I think document.forms["iframe1"] is better supported), you don't even need javascript. In the iframed page, you only need to include meta refresh tag in the iframed page.
CODE
<meta http-equiv="refresh" content="300" />


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 04:15AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month