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

Base tag broken: Images/Links have invalid paths in sub-directory documents. #1508

Closed
jblas opened this Issue Apr 22, 2011 · 4 comments

Comments

Projects
None yet
3 participants
@jblas
Contributor

jblas commented Apr 22, 2011

If you use FireFox 4 or any other browser (Chrome) that shows you the href of a link when you hover over it, and you navigate to:

http://jquerymobile.com/test/

then click on "Pages & dialogs", after the new page transitions in, hover over the listview items on the page and see what the browser displays. I'm seeing URLs like this:

http://jquerymobile.com/test//test/docs/pages/docs-pages.html

Notice the "/test//test" in the middle? it should be displaying:

http://jquerymobile.com/test/docs/pages/docs-pages.html

This seems to be due to the fact that we switched to passing in site relative URLs into base.set(). When the base code was originally written, I think it assumed that the path passed in would always be document relative which is why it prepends the HREF passed in with docbase..

@ghost ghost assigned jblas Apr 22, 2011

@scottjehl

This comment has been minimized.

Show comment
Hide comment
@scottjehl

scottjehl Apr 22, 2011

Contributor

This url demonstrates that the base tag is no longer correct:
http://jquerymobile.com/test/#/test/docs/about/intro.html

Contributor

scottjehl commented Apr 22, 2011

This url demonstrates that the base tag is no longer correct:
http://jquerymobile.com/test/#/test/docs/about/intro.html

@johnbender

This comment has been minimized.

Show comment
Hide comment
@johnbender

johnbender Apr 24, 2011

Contributor

I took a look at this after Kin mentioned it on Friday, and the naive fix is to check for an absolute path in the hash and just use location.protocol + "//" + location.host for docBase. In the case where there's a relative path (backward compat) we need to do a bit more work.

Mind you this came from a cursory first look.

Contributor

johnbender commented Apr 24, 2011

I took a look at this after Kin mentioned it on Friday, and the naive fix is to check for an absolute path in the hash and just use location.protocol + "//" + location.host for docBase. In the case where there's a relative path (backward compat) we need to do a bit more work.

Mind you this came from a cursory first look.

@johnbender

This comment has been minimized.

Show comment
Hide comment
@johnbender

johnbender Apr 25, 2011

Contributor

I've started work on handling this, and I think Kin is working on documenting the various cases to handle with the base tag but I thought I would get my own notes down here so we can compare. To start, handling the dynamic base tag:

base tags need to be set in 3 cases

  1. initial load - where there is no value available from an anchor or form action to tell us what the base href value should be
  2. loading a page from a page relative url - the relative path must be stripped of trailing file information and applied to the current host and pathname
  3. loading a page from a host relative url - the path must be stripped of trailing file information and applied to the current host.
Contributor

johnbender commented Apr 25, 2011

I've started work on handling this, and I think Kin is working on documenting the various cases to handle with the base tag but I thought I would get my own notes down here so we can compare. To start, handling the dynamic base tag:

base tags need to be set in 3 cases

  1. initial load - where there is no value available from an anchor or form action to tell us what the base href value should be
  2. loading a page from a page relative url - the relative path must be stripped of trailing file information and applied to the current host and pathname
  3. loading a page from a host relative url - the path must be stripped of trailing file information and applied to the current host.
@jblas

This comment has been minimized.

Show comment
Hide comment
@jblas

jblas Apr 25, 2011

Contributor

I started documenting the use cases we need to handle here:

https://github.com/jquery/jquery-mobile/wiki/Refactor:-navigation-paths

Contributor

jblas commented Apr 25, 2011

I started documenting the use cases we need to handle here:

https://github.com/jquery/jquery-mobile/wiki/Refactor:-navigation-paths

@ghost ghost assigned johnbender and jblas May 3, 2011

@scottjehl scottjehl closed this in 4b4ee54 May 6, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment