Duplicate pages created in DOM #1024
Description
Duplicate page detection is based on data-url attribute, but the URL is not normalized. So, if you have a page structure like:
.../page1.html
.../dir2/page2.html
And open up first page1, navigate from page1 to page 2 with hyperlink <a href="dir2/page2.html">
and then navigate from page2 to page1 with hyperlink <a href="../page1.html">
, the page navigation logic will look in DOM for a page with data-url attribute "dir2/../page1.html", which it of course will not find and so a duplicate page will be loaded into DOM. Using data-url attribute in page div will not help since the value that is looked for will depend on the location of the page where the link is.
Tested with Chrome browser.
Suggested solution: Normalize URLs before using them. At the same time you would probably solve the current problem that you cannot use absolute URLs like "/foo/bar/page.html" because it will break the URL used in the injected <base>
element. So, if your current URL is "http://www.example.com/foo/#dir2/page2.html", then navigation to "../page1.html" should result in URL "http://www.example.com/foo/#page1.html" (and NOT "http://www.example.com/foo/#dir2/../page1.html"), and similarly navigation to "/foo/dir3/page3.html" should result in URL "http://www.example.com/foo/#dir3/page3.html" (and NOT "http://www.example.com/foo/#/foo/dir3/page3.html").