Skip to content

Commit

Permalink
fix: ./ link does not work ad expected when open html as local file.
Browse files Browse the repository at this point in the history
  • Loading branch information
h13i32maru committed May 24, 2015
1 parent 6068774 commit 97f47cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Publisher/Builder/template/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
8 changes: 8 additions & 0 deletions src/Publisher/Builder/template/script/patch-for-local.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(function(){
if (location.protocol === 'file:') {
var elms = document.querySelectorAll('a[href="./"]');
for (var i = 0; i < elms.length; i++) {
elms[i].href = './index.html';
}
}
})();

0 comments on commit 97f47cf

Please sign in to comment.