How to Redirect Page through Javascript, Jquery

How to redirect page through Javascript, Jquery code. Redirection means taking user to new location. Let’s check some Javascript and Jquery code to redirect a page.

Reload Page through Javascript and Jquery.

How to Redirect Page through Javascript, Jquery

1. Redirect page on Checkbox check

I have a checkbox and i want to redirect a page on some particular link when checkbox is checked. So how to do it.

Create one checkbox

Jquery snippet to redirect a page to webrewrite.com when user checked a checkbox.

Alternative Method.

2. Redirect page on button click.

Jquery snippet.

OR

On the button onclick event we call redirect() method. Define the redirect method.

Use window.location.replace to Redirect Page

So how window.location.replace is different from window.location.href.

replace method navigates to the mentioned URL without adding a new record to the history.

NOTE: replace method does not keep originating page in session history, which may affect behaviour of back button.

Tagged , . Bookmark the permalink.

About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.