Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Learn More

Linux-style absolute path for URLs not working on Windows

  • 1 trả lời
  • 0 gặp vấn đề này
  • 9 lượt xem
  • Trả lời mới nhất được viết bởi cor-el

more options

Hello,

On Windows chromium-based browsers, the links with linux-style urls : "/path/to/file" are expanded to "/<current device letter>/path/to/file" which can prove pretty handy.

Example: A local "D:\html\index.html" file declaring a '<script type="text/javascript" src="/js/file.js"></script>' will have the "src" expanded to "file:///D:/js/file.js".

Of course on this particular example, it would be easy to use relative paths but "absolute" paths can be useful when referencing shared common files (javascript, css, ...). This way, an html file can be tested locally (without a local server) before being deployed as-is on a server.

Unfortunately, on Firefox there seems to be no such mechanism, unless I have missed something...

Is there any plan to add such a feature?

Hello, On Windows chromium-based browsers, the links with linux-style urls : "/path/to/file" are expanded to "/<current device letter>/path/to/file" which can prove pretty handy. Example: A local "D:\html\index.html" file declaring a '<script type="text/javascript" src="/js/file.js"></script>' will have the "src" expanded to "file:///D:/js/file.js". Of course on this particular example, it would be easy to use relative paths but "absolute" paths can be useful when referencing shared common files (javascript, css, ...). This way, an html file can be tested locally (without a local server) before being deployed as-is on a server. Unfortunately, on Firefox there seems to be no such mechanism, unless I have missed something... Is there any plan to add such a feature?

Tất cả các câu trả lời (1)

more options

You expand a relative path starting with the location of the file path with this link. D:\html\index.html expands "/js/file.js" => "D:/html/js/file.js" as you aren't allowed to go back in the directory tree for security reasons (i.e. you can only access a sub directory).