Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 2c99787

Browse files
author
scottjehl
committed
fixed bug where a preset data-url was being prefixed by the base url, rather than replacing the whole hash. Fixes #591
1 parent 70112b1 commit 2c99787

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

docs/pages/docs-links-urltest/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</head>
1111
<body>
1212

13-
<div data-role="page" data-url="docs-links-urltest/">
13+
<div data-role="page" data-url="docs/pages/docs-links-urltest/">
1414
<div data-role="header">
1515
<h1>URL Test Page</h1>
1616
</div>

docs/pages/docs-pages.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,14 @@ <h2>Local, internal linked "pages"</h2>
170170

171171

172172
<h2>Back linking</h2>
173-
<p>If you use the attribute <code>data-rel="back"</code> on an anchor, any clicks on that anchor will mimic the back button, going back one history entry and ignoring the anchor's default href. This is particularly useful when linking back to a named page, such as a link that says "home", or when generating "back" buttons with JavaScript, such as a button to close a dialog. When using this feature in your source markup, <strong>be sure to provide a meaningful href that actually points to the URL of the referring page (this will allow the feature to work for users in C-Grade browsers</strong>. Also, pease keep in mind that if you just want a reverse transition without actually going back in history, you should use the <code>data-direction="reverse"</code> attribute instead.</p>
173+
<p>If you use the attribute <code>data-rel="back"</code> on an anchor, any clicks on that anchor will mimic the back button, going back one history entry and ignoring the anchor's default href. This is particularly useful when linking back to a named page, such as a link that says "home", or when generating "back" buttons with JavaScript, such as a button to close a dialog. When using this feature in your source markup, <strong>be sure to provide a meaningful href that actually points to the URL of the referring page (this will allow the feature to work for users in C-Grade browsers</strong>. Also, please keep in mind that if you just want a reverse transition without actually going back in history, you should use the <code>data-direction="reverse"</code> attribute instead.</p>
174174

175175
<h2>Redirects and linking to directories</h2>
176176
<p>When linking to directory indexes (such as href="typesofcats/" instead of href="typesofcats/index.html"), you must provide a trailing slash. This is because jQuery Mobile assumes the section after the last "/" character in a url is a filename, and it will remove that section when creating base urls from which future pages will be referenced.</p>
177177

178-
<p>However, you can work around this issue by returning your page div with a <code>data-url</code> attribute already included, and jQuery Mobile will use that instead of the url used to request that page. This also allows you to return urls that change as the result of a redirect, for example, you might post a form to "/login.html" but return a page from the url "/account" after a successful submission. This tool allows you to take control of the jQuery Mobile history stack in these situations. Here's an example:</p>
178+
<p>However, you can work around this issue by returning your page div with a <code>data-url</code> attribute already specified. When you do this, jQuery Mobile will use that attribute's value for updating the URL, instead of the url used to request that page. This also allows you to return urls that change as the result of a redirect, for example, you might post a form to "/login.html" but return a page from the url "/account" after a successful submission. This tool allows you to take control of the jQuery Mobile history stack in these situations. Here's an example:</p>
179179

180-
<p>The following link points to "docs-links-urltest/index.html": <a href="docs-links-urltest/index.html">Test Link</a> which is a directory with an index page. The return page will update the hash as "docs-links-urltest/" with a trailing slash. This is done via the data-url attribute in that page's source.</p>
180+
<p>The following link points to "docs-links-urltest/index.html": <a href="docs-links-urltest/index.html">Test Link</a> which is a directory with an index page. The return page will update the hash as "docs/pages/docs-links-urltest/" with a trailing slash. This is done via the data-url attribute in that page's source. Keep in mind that the value will replace the entire hash, and it is up to you to replace it with a URL that actually resolves to the correct page when requested via refresh or deep link.</p>
181181

182182

183183
<p>Learn more about the technical details of the navigation model and <a href="docs-navmodel.html">Ajax, hashes and history</a> in jQuery mobile.</p>

js/jquery.mobile.navigation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@
506506
if(base){
507507
base.set( redirectLoc );
508508
}
509-
url = fileUrl = path.makeAbsolute( path.getFilePath( redirectLoc ) );
509+
url = fileUrl = path.getFilePath( redirectLoc );
510510
}
511511
else {
512512
if(base){

0 commit comments

Comments
 (0)