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

  • SEARCH
  • Home
  • 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 8548305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:27:52+00:00 2026-06-11T13:27:52+00:00

Is there a way to update the URL programatically without reloading the page? EDIT:

  • 0

Is there a way to update the URL programatically without reloading the page?

EDIT: I added something in the title in post .I just want to make it clear that I don’t want to reload the page

  • 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-11T13:27:53+00:00Added an answer on June 11, 2026 at 1:27 pm

    Yes – document.location = "http://my.new.url.com"

    You can also retrieve it the same way eg.

    var myURL = document.location;
    document.location = myURL + "?a=parameter";
    

    The location object has a number of useful properties too:

    hash            Returns the anchor portion of a URL
    host            Returns the hostname and port of a URL
    hostname        Returns the hostname of a URL
    href            Returns the entire URL
    pathname        Returns the path name of a URL
    port            Returns the port number the server uses for a URL
    protocol        Returns the protocol of a URL
    search          Returns the query portion of a URL
    

    EDIT:
    Setting the hash of the document.location shouldn’t reload the page, just alter where on the page the focus is. So updating to #myId will scroll to the element with id="myId". If the id doesn’t exist I believe nothing will happen? (Need to confirm on various browsers though)

    EDIT2: To make it clear, not just in a comment:
    You can’t update the whole URL with javascript without changing the page, this is a security restriction. Otherwise you could click on a link to a random page, crafted to look like gmail, and instantly change the URL to http://www.gmail.com and steal people’s login details.
    You can change the part after the domain on some browsers to cope with AJAX style things, but that’s already been linked to by Osiris. What’s more, you probably shouldn’t do this, even if you could. The URL tells the user where he/she is on your site. If you change it without changing the page contents, it’s becomes a little confusing.

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

Sidebar

Related Questions

I there a way to update a row without mentioning fields name ? I
Is there a way to update only the parent UpdatePanel without updating the child
Is there is any way to update shared OR(Object Repository) in QTP without having
Is there a way to send data (like update status or post to friend's
Is there any way to update nested documents by id or some other field?
Is there any way to update my beta testing application on windows phone marketplace?
is there a way to update a binding before or when a command is
Is there any way to update a table layout after it has been created?
Is there a way to update only Hour part in a DateTime field?? If
Is there an easy way to update the data source for multiple pivot tables

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.