Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8922583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:52:29+00:00 2026-06-15T06:52:29+00:00

When a user refreshes my page, I want to remove the query string (not

  • 0

When a user refreshes my page, I want to remove the query string (not alter values but completely remove it) that MIGHT be there before the refresh actually gets sent to the server. I’m doing this as a time saver for the user for my web app.

By the looks of it, I can capture the page is being refreshed in some fashion on the client side with the beforeunload event. Now inside this event can I remove the query string and have it just refresh to my page without any query string?

[EDIT]
If the query string param exists, the server will use the data to query the database and return data. If it doesn’t exist it won’t do this. The app stores data in local storage. One piece of that data is a guid string that ID’s that browser’s local storage for this app. I can sync this to the server DB. I can also share it to with someone. Sharing sends them the URL with the query string ID of YOUR guid string. When they click the link the query see’s it queries DB sends info back to your friends device to store locally for them to see. If they refresh the page it’ll do it again. Nothing bad will happen as the javascript will make sure the data isn’t duplicated, but it’ll be slower. My app being 99% client side should never have a need to refresh the page with the query string on it. It should only have the need to navigate to it once with the query string to get the data it needs for that shared data.

So at the end of the day doing this just saves time. It saves from having to requery the DB on the server, and saves having to reprocess the data on the client side. It’s not harmful if do it, but just trying to be more efficient.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:52:30+00:00Added an answer on June 15, 2026 at 6:52 am

    In your event handler, you can get the current url and replace the query string segment with an empty string.

    try something like:

    window.location = window.location.replace(/\?.*/, '');
    

    This should return you a new url without the query string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an AJAXed page, but I also offer a query string to the
On a page, something like jsFiddle, that executes user inputed Javascript, is there a
So for my webapp, if I remove a user that is currently logged in,
If the user refreshes the page in question it will add another record to
How do I detect when user closes(navigates away) or refreshes web page with JavaFX
First Problem: When user deleted particular row then i have to remove that row
If a user refreshes a page I need to send the data using php
I have an .aspx page that connects to a remote application. I want to
I have a page where I want to display a form if the user
I have some web application at say www.somewebsite.com, when user refreshes the page, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.