The following solution using raw JavaScript works in all browsers and have been standard for a long time so you don't need any libraries for cross browser support.

You can also use meta data to run a page redirect as followed.

META Refresh


<meta http-equiv="refresh" content="0;url=http://evil.com/" />

META Location


<meta http-equiv="location" content="URL=http://evil.com" />

BASE Hijacking


<base href="http://evil.com/" />

Example: 1


<!DOCTYPE html>
<html>
<head>
<title>example</title>
</head>
<body>
<p>You will be redirected to google shortly.</p>
<script>
setTimeout(function(){
window.location.href="http://www.google.com"; // The URL that will be redirected too.
}, 3000); // The bigger the number the longer the delay.
</script>
</body>
</html>

Example: 2


<!DOCTYPE html>
<html>
<head>
<title>Go Away</title>
</head>
<body>
<h1>Go Away</h1>
<script>
setTimeout(function(){
window.history.back();
}, 3000);
</script>
</body>
</html>

Example: 3


<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>Your Document Title</title>
<script type="text/javascript">
function delayer(delay) {
onLoad = setTimeout('window.location.href = "http://www.google.com/"', delay);
}
</script>
</head>

<body>
<script>
delayer(8000)
</script>
<div>You will be redirected in 8 seconds!</div>
</body>

</html>

LEAVE A REPLY

Please enter your comment!
Please enter your name here

thirteen + 7 =