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 8753303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:23:58+00:00 2026-06-13T13:23:58+00:00

What are the preferred ways to do a redirection and a reload in Dart?

  • 0

What are the preferred ways to do a redirection and a reload in Dart?

Do we just use: window.location.href = window.location.href?

  • 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-13T13:23:59+00:00Added an answer on June 13, 2026 at 1:23 pm

    There are a few different ways to handle URI changes and each have their own purpose.

    1. When you want to send the user to another URI:

      • window.location.assign('http://google.com')

        This one sends the user to Google, keeping the browsing history (the back button history). This is like clicking on a link.

      • window.location.href = 'http://google.com'

        The same as above, just another way to do it. href is a setter, and causes the assignment to happen. I feel the previous version is cleaner.

      • window.location.replace('http://google.com');

        However, the replace() method on LocalLocation object does not only send the user to Google, but also does not put the originating page in the session history, which means the user will not suffer from the never-ending back-button nightmare.

        This is essentially the same as an HTTP redirect. The history is skipped.

    2. When you want to do a reload/refresh.

      • window.location.assign(window.location.href)

        Reloads the current page to the exact same URI. This does not contain POST data. Some of the resources (like images, etc.) may me reloaded from the cache, so it might not be a full reload.

        This is essentially the same as pressing F5 and skipping the sending of POST data.

      • window.location.href = window.location.href

        Again, the same as previous.

      • window.location.reload()

        This way of reloading the page causes also the POST data to be sent. The “JavaScript version” of window.location.reload() also supports a parameter that specifies whether to skip the cache or not. However, the current Dart implementation does not support that parameter, and defaults to fetch the resources from cache.

        This cache parameter may be added to Dart at some point, but it’s not there yet. When it arrives, you most likely just pass true as the first parameter and then it would be like Ctrl + Shift + R.

    Summary

    • I want to simulate a click on <a> tag.

    Use window.location.assign(url).

    • I want to redirect to a new website like the HTTP redirection and skip the back-button history.

    Use window.location.replace(url).

    • I want to do an F5 with POST data.

    Use window.location.reload().

    • I want to do an F5 without POST data.

    Use window.location.assign(window.location.href).

    • I want to do an Ctrl + Shift + F5.

    Not available, maybe in the future. It would probably be window.location.reload(true).

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

Sidebar

Related Questions

I've seen several different ways for :use in clojure--what's the idiomatic/preferred method? #1 (ns
Which method is preferred to just show 2 links vertically, one over another? in
From the below 2 ways to enumerate a collection, should one be preferred over
Does one of these two ways have to be preferred or is it only
I'm just learning JavaScript and it seems like there are a number of ways
Below is just some sample Javascript that I posted that shows 2 different ways
Just out of curiosity, what is the preferred way to achieve interprocess synchronization on
What is the preferred way to work with Singleton class in multithreaded environment? Suppose
Which method is preferred for adding a row to a table? var tr =
What is the preferred way of deploying a compojure/sinatra applications? I have multiple sites

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.