Refresh content automatically after some period time on Rails

by Hojung posted Jan 22, 2015
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

+ - Up Down Comment Print
Refresh content automatically after some period time on Rails

If you use the following javascript to refresh page.
<html>
<head>
<script type="text/JavaScript">
<!--
function timedRefresh(timeoutPeriod) {
	setTimeout("location.reload(true);",timeoutPeriod);
}
//   -->
</script>
</head>
<body onload='JavaScript:timedRefresh(5000);'>
<p>This page will refresh every 5 seconds.</p>
</body>
</html>

It works when you visit the page by typing the URL on browser, however it might not work (not refreshing) if you go to the page via the link like below.
<a href="http://x.x.x.x/">Home</a>

Then you might need to set the target attribute with 'top' like below.
<a href="http://x.x.x.x/" target="top">Home</a>




Designed by sketchbooks.co.kr / sketchbook5 board skin

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5