Spread the love

How to remove query string from URL using JQuery – ItSolutionStuff.com ItSolutionStuff.com Toggle navigation Home PHP PHP MySQLMongo DB Laravel Codeigniter Javascript JQuery Ajax Angular Node Vue JSON Laravel Laravel 8Laravel 7Laravel 6Laravel 5 Laravel 4 Tags Demo PostAngular 11Laravel 8Laravel Tutorial How to remove query string from URL using JQuery By Hardik Savani | February 17, 2016 | Category : jQuery Why remove query strings?

Main two reasons for this.

1. Clear URL alwaya look better than the long URL

2. When you are not remove your query string from URL. then all get variable show in you URL string. sometime it not good for a security

You can remove your query string using this simple Jquery code.


var uri = window.location.toString();

if (uri.indexOf(“?”) > 0) {

var clean_uri = uri.substring(0, uri.indexOf(“?”));

window.history.replaceState({}, document.title, clean_uri);



Hardik Savani
My name is Hardik Savani. I’m a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage. Follow Me: Github Twitter ***Do you want me hire for your Project Work? Then Contact US. Popular Posts Jquery – Display a loading gif image before a image loads using Eager ImageLoader plugin How to prevent submit form on enter key except textarea in JQuery? How to Count Number of Rows in Table Jquery? How to get unique values from array in Jquery? PHP MySQL – Simple Image Gallery CRUD example from scratch How to Remove Array Element in Jquery by Value? How to Change Thumbnail Image in Dropzone JS? Ckeditor required field validation example in Jquery AngularJS – how to remove html tags using filter? Laravel – Follow Unfollow System Example Codeigniter Ajax Form Submit Example Categories 715Laravel 390PHP 324Angular 278jQuery 158Bootstrap 140Javascript 99MySql 76Ajax 64HTML 59Codeigniter 44Vue.JS 39React JS 21JSON 21Ubuntu 20Installation 19Guest Post 11CSS 11Git 11Node JS 8Google Map 7SQL 6Google API 6JQuery UI 6Server 5Typeahead JS 5Axios 5Socket.io 4Highcharts 4Elasticsearch 3Facebook API Latest Posts Angular Material Datepicker Change Date Format Example Angular Material Datepicker Disable Weekends Dates Example Angular Material Datepicker Disable Specific Dates Example Challenges of Cloud-Native Security and How to Mitigate Them Angular Material Datepicker Disable Future Dates Example
Subscribe Your Email address: Subscribe Top Links: Home List Of Categories Demo Posts Disclaimer Latest Posts Contact US About US

© 2016 All Rights Reserved • www.itsolutionstuff.com