Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Fix initial load of fragment URLs #2762

Closed
wants to merge 1 commit into from
Closed

Fix initial load of fragment URLs #2762

wants to merge 1 commit into from

Conversation

KyleMit
Copy link
Contributor

@KyleMit KyleMit commented Sep 30, 2014

Here is an example of a fragment URI that exists in the documentation:

http://angular-ui.github.io/bootstrap/#datepicker

Within the documentation page, this gets picked up by smoothscroll-angular-custom.js and converted to this:

http://angular-ui.github.io/bootstrap/#/datepicker

Unfortunately, when you try to navigate fresh to either of those urls, the initialize code in app.js picks up the hash location and doesn't properly replace the element id, resulting in the following 404 page:

404

The location.replace() method should include the anchor tag and the element ID as can be seen in smoothscroll-angular-custom.js

This will produce the proper result when navigating from elsewhere on the web and fix a lot of broken links.

Both of the following on my forked version of gh-pages should work:

http://kylemitofsky.com/angular-bootstrap/#datepicker
http://kylemitofsky.com/angular-bootstrap/#/datepicker

@chrisirhc
Copy link
Contributor

Just need to check whether this work for legacy browsers such as IE9.

@KyleMit
Copy link
Contributor Author

KyleMit commented Oct 1, 2014

I just tested on IE8/9/10/11 & FF & Chrome

smoothscroll-angular-custom.js appears to be broken on IE8 & IE9. If you load the regular page and try to navigate to an anchor tag, nothing will happen. If you load a page with a fragment uri in either of these browsers, nothing will load. This is true for the current production site and remains true for my pull request.

The pull request addresses IE10, IE11, FF, and Chrome

In all of these browsers smooth scrolling works, but the application breaks when an acnhor URL is initially navigated to because location.replace() in the page load code sets the address to use the name of an anchor item as a folder directory angular-ui.github.io/bootstrap/datepicker instead of an anchor angular-ui.github.io/bootstrap/#datepicker. Since nothing exists at the former url, a 404 error is returned.

@KyleMit
Copy link
Contributor Author

KyleMit commented Oct 26, 2014

Any word on this? It would be a really nice fix for linking to the documentation.

@chrisirhc chrisirhc closed this in eab6daf Oct 27, 2014
@chrisirhc
Copy link
Contributor

Thank you!

Just for future reference, such fixes should go to the master branch as the gh-pages branch is generated from the code in the master branch.

OronNadiv pushed a commit to lanetix/bootstrap that referenced this pull request Nov 18, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants