location.pathname not work for file:// urls

This commit is contained in:
James Feng Cao 2022-10-12 22:01:03 +08:00
parent f82c34ba62
commit ddcf396b11
2 changed files with 5 additions and 13 deletions

View File

@ -171,9 +171,10 @@
$(dictinput).on('change', accept); $(dictinput).on('change', accept);
{ {
let path = location.pathname; let href = location.href;
let iSlash = path.lastIndexOf('/'); let iQ = href.indexOf('?');
let filenames=path.substring(iSlash+1); let iSlash = path.lastIndexOf('/',iQ-1);
let filenames=path.substring(iSlash+1,iQ);
{ {
let iDot = filenames.indexOf('.'); let iDot = filenames.indexOf('.');
if(iDot>0) if(iDot>0)

View File

@ -1,10 +1 @@
<!DOCTYPE html> <meta http-equiv="refresh" content="0; url=en/index.html">
<html lang="en">
<head>
<title>en/</title>
<link rel="canonical" href="en/">
<meta name="robots" content="noindex">
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=en/">
</head>
</html>