Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect after few second in rails 3.1

Is there a way to redirect after few second only by using rails?

I want when A user click on a link see the page and after few second get redirected to his profile(user_path)

like image 396
Jonathan de M. Avatar asked Feb 09 '12 07:02

Jonathan de M.


1 Answers

Because HTML is part of a Rails application you could use the standard html redirect option by default:

<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html">

Change 0 to number of seconds you want to wait before redirection.

On the other hand you could use javascript (also part of rails applications):

<html>
<head>
<script type="text/javascript">
function delayedRedirect(){
    window.location = "/default.aspx"
}
</script>
</head>
<body onLoad="setTimeout('delayedRedirect()', 3000)">
<h2>You'll be redirected soon!</h2>
</body>
</html>
like image 170
takacsot Avatar answered Oct 30 '22 03:10

takacsot