JavaScript Redirect URL Example

JavaScript Redirect URL Example

Welcome to the In Pakainfo.com website! You will Step By Step learn web programming, easy and very fun. This website allmost provides you with a complete web programming tutorial presented in an easy-to-follow manner. Each web programming tutorial has all the practical examples with web programming script and screenshots available.For

Simple JavaScript Redirection to Another Page Example

URL redirection using javascript, also called URL forwarding or onther redirect page, is a way to automatically page redirect a web app-page to another web page. and below examples The redirected page is often on the same website and location, or it can be on a all the different web site or web folders or a web server.

Also Read :  JavaScript Automatically Page Redirection

Method : 1. Using window.location method:

The window.location object and its can be used to get simple the current page url address (URL) and to redirect to your the browser to a any new page.

 <script type="text/javascript">
window.location="http://www.Pakainfo.com";
</script>
[php]

<h3>Method : 2. Using window.location.href method:</h3>
[php]
<script type="text/javascript">
window.location.href="http://www.Pakainfo.com";
</script>

Method : 3. Using window.location.assign method:

<script type="text/javascript">
window.location.assign="http://www.Pakainfo.com";
</script>

Method : 4. Using window.location.replace method:

<script type="text/javascript">
window.location.replace="http://www.Pakainfo.com";
</script>

JavaScript Redirect to Another Page After ‘x'(Like 5 seconds) Seconds

Method : 1. Using onLoad method:

 <body onLoad="setTimeout(location.href='http://www.Pakainfo.com', '5000')">
 

Method : 2. Using Redirect function: Example

 <script type="text/javascript">
function Redirect()
{
 window.location="http://www.Pakainfo.com";
}

document.write("You will be your page redirected to a new page in 5 or more seconds set");
setTimeout('Redirect()', 5000);

</script>

JavaScript Redirect to Another Page On Load Example

Method : 1. Using onLoad method: Example

 <body onLoad="setTimeout(location.href='http://www.Pakainfo.com', '0')">
 

Method : 2. Using a function: Example

 <script type="text/javascript">
 
function Redirect()
{
 window.location="http://www.Pakainfo.com";
}
setTimeout('Redirect()', 0);
 
</script>

JavaScript Redirect to Another Page On Click Example

 <head>
<script>
function reButton()
{
window.location="http://www.Pakainfo.com";
}
</script>
</head>
<body>
<button onclick="reButton()">Click me</button>
</body>

JavaScript Redirect to Another Page Passing Variables Example

 <body>
<form action="/search">
Enter your search text: <input type="text" id="textsvalue" name="q">
 <input onclick="searchFuncation()" type="submit" value="SEARCH Value" /></form>
<script>
function searchFuncation()
{
	var search = document.getElementById("textsvalue").value;
	window.location = '/search?q='+search; 
}
</script>
</body>

Example

Also Read :  Great UNIX Commands Tutorial for Beginners

jquery redirect to another page with post data | how to redirect to another page in javascript on button click | how to redirect to another page in javascript with parameters | html redirect with parameters

We hope you get an idea about JavaScript Redirect URL Example
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

Add a Comment

Your email address will not be published. Required fields are marked *