Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reload attempts to a url with a hash do nothing. #377

Closed
DavidCPhillips opened this issue Jan 5, 2016 · 0 comments
Closed

Reload attempts to a url with a hash do nothing. #377

DavidCPhillips opened this issue Jan 5, 2016 · 0 comments
Labels

Comments

@DavidCPhillips
Copy link
Contributor

Reloads on history navigations (after a nav limit or error) always occur after the url has already been set to the new page. Typically this is not an issue, but if the url contains a hash, the browser ignores the call to 'window.location.href'.

For example.

  1. Navigate to 'https://www.google.com/#foo'
  2. Execute:
    window.location.href = 'https://www.google.com/#foo';

Nothing occurs. We probably need to follow the location.href change with a call to location.reload.

@nicksay nicksay added the bug label Jan 6, 2016
@nicksay nicksay added this to the SPF 23 (v2.3.1) milestone Jan 6, 2016
nicksay added a commit to nicksay/spfjs that referenced this issue Jan 6, 2016
When reloading a URL that contains a hash (e.g. `/page#target`) after an error,
assigning to `window.location.href` is not enough.  Explicitly call
`window.location.reload()` to ensure a reload happens.

Closes youtube#377.
nicksay added a commit to nicksay/spfjs that referenced this issue Jan 7, 2016
The previous change explicitly called `window.location.reload()` after assigning
to `window.location.href` to ensure a reload happens for URLs that contain a
hash.  However, an immediate call to `window.location.reload()` will cancel
navigation started by the assignment to `window.location.href` for other cases.
Fix this by limiting calls to `window.location.reload()` for only those cases
where it is needed.

Fixes youtube#377
nicksay added a commit to nicksay/spfjs that referenced this issue Jan 8, 2016
The previous change explicitly called `window.location.reload()` after assigning
to `window.location.href` to ensure a reload happens for URLs that contain a
hash.  However, an immediate call to `window.location.reload()` will cancel
navigation started by the assignment to `window.location.href` for other cases.

Instead, check whether the new URL will trigger a navigation first.  Adjust
the navigable-check function to account for hash URL to standard URL transitions
(e.g. `/page#target` to `/page`) and update the tests.

Fixes youtube#377
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants