问题
Our daily builds are stored in a shared network directory. My team wants me to put a link to that location on the results page - the most natural place would be among the artifacts. Clicking on that link should open the folder for viewing, copying, etc.
I've tried to implement the following solution: create an html file that redirects to the network directory and save it as an artifact. Here's the html file I generate (let's call it LinkToInstallation.html
):
<html>
<head>
<script type='text/javascript'>
window.location='file:////file_server/dir_path'
</script>
</head>
<body>
</body>
</html>
Jenkins puts a link to this file among the artifacts. When I click on it from IE it redirects just fine, but from Chrome no redirection occurs, just an empty page is displayed. If I download the file (via Save Link As
) and open it locally with Chrome - it works.
(1) Is there a workaround so that people do not have to change their Chrome settings? (2) If not, how should Chrome be set up to redirect properly?
回答1:
Chrome does not permit web pages to link to file://
URLs unless they were themselves loaded from file://
URLs. This is as a security precaution, as web pages running from file://
have permissions to read any file on your system. Similar restrictions apply for most other browsers.
Any reason you can't run an internal web server from your shared network directory? That'd solve the problem neatly.
来源:https://stackoverflow.com/questions/9152792/link-to-a-network-location-using-file-does-not-work-in-chrome