Posted inJavaScript / jQuery

javascript redirect to relative url with parameters

Today, We want to share with you javascript redirect to relative url.In this post we will show you javascript redirect to url, hear for javascript redirect to url with parameters we will give you demo and example for implement.In this post, we will learn about JavaScript Redirect URL Example with an example.

javascript redirect to relative url with parameters

Example 1: js window location relative path

//To fetch just the relative path of a window location.

const RELATIVE_PATH = window.location.pathname; 

Example 2: js redirect to relative url

window.location.href = '/product/api/mobile'; //relative to domain

Example 3: javascript redirect to relative url

window.location.href = "http://www.pakainfo.com/php.html";

Example 4: change windlow location relitave to current one

//Only line of Js code:
window.location.href = '../'; //one-single level up

I hope you get an idea about javascript redirect on page load.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

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

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype