Skip to content

Commit 39393e4

Browse files
sabakugaarayyx990803
authored andcommitted
strip origin when normalizing base (#1448)
fix #1426
1 parent 023c899 commit 39393e4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/history/base.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,14 @@ export class History {
188188
}
189189

190190
function normalizeBase (base: ?string): string {
191+
// respect <base> tag
191192
if (!base) {
192193
if (inBrowser) {
193194
// respect <base> tag
194-
const baseEl = document.querySelector('base')
195-
base = (baseEl && baseEl.getAttribute('href')) || '/'
195+
const baseURI = document.baseURI || '/'
196+
const a = document.createElement('a')
197+
a.href = baseURI
198+
base = a.pathname
196199
} else {
197200
base = '/'
198201
}

0 commit comments

Comments
 (0)