0

Suppose my url is http://example.com#example.org i want to redirect my current tab "example.com" after 5 sec to query parameter "example.org"

<head>
<title></title>

<script type="text/javascript">
var x = window.location.hash.substr(1);
</script>

<meta http-equiv="refresh" content="4;url=x"/>

</head>
<body>
</body>

2 Answers 2

1

Instead of using a meta tag to refresh, you should just use Javascript with a timeout to handle the redirect instead. A metatag cannot get a value passed in from Javascript using the approach you have.

<script type="text/javascript">
setTimeout(function() {
    window.location.href = window.location.hash.substr(1);
}, 5000);
</script>
Sign up to request clarification or add additional context in comments.

Comments

0

Alternative approach, using script to write your metatag:

<head>
<script type="text/javascript">
  var x = window.location.hash.substr(1);
  document.write("<meta http-equiv=\"refresh\" content=\"4;URL='" + x + "'\"/>");
</script>
</head>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.