Local link in hyperlink

Hi all

This works great in browser: file://///mediecenter/medie%20center
If i paste the above link into edge, it will open the path locally.

But if i try to put it on a website using: <p><a href="file://///mediecenter/medie%20center" target="_blank"> mediecenter</a></p>
Then it wont let me click the link.

I kinda just want it to paste "file://///mediecenter/medie%20center" into the adress bar and enter. But something goes wrong when you put file:///// into a href syntax.
What am i missing?

Best regards Mike Kristensen
Mike KristensenIT administratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike KristensenIT administratorAuthor Commented:
I tried this aswell: <p><a href="file:///\\mediecenter\medie%20center" target="_blank"> mediecenter</a></p>

Still it seems that it wont accept that its a link. :S
0
ChrisSr. Systems EngineerCommented:
"http" is a protocol pointing to a web resource, "file" points to a local resource - you can't use a local resource out on the internet, as \\mediacenter, isn't available externally.
You could trick it to work, if you were all on the same LAN, and specified an absolute path, but each client, would have to have local access to that path.
For example, If you link to something like

<a href="file:///X:/yourfile.pdf">yourfile.pdf</a>

Open in new window


The above represents a link to a file called X:/yourfile.pdf on the X: drive on the machine on which you are viewing the URL. Each machine you want to access, would need to have an X: drive that is mapped to the location.

You can also do this, for example the below creates a link to C:\temp\test.pdf

<a href="file:///C:/Temp/test.pdf">test.pdf</a>

Open in new window


By specifying file:// you are indicating that this is a local resource. This resource is NOT on the internet.

Best practice would be to link your files relative to your webpage. <a href="files/file.txt"> and store your file into files/ folder.
0
Julian HansenCommented:
This is for security reasons. If you load the html file with the link into the browser using file://path/to/file then it will work.

If you load the file by getting it form a web server - it won't.

Reason: Domains are not the same - the source of the page does not match the source referred to in the link so the browser will not allow the request.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

ChrisSr. Systems EngineerCommented:
To add on to Julian's comment,
Most newer browsers won't even support this type of linking format anymore, as they pose a security risk. Take a look at the security considerations posted under the standard.
https://tools.ietf.org/html/rfc8089

It can be done, however, you are implementing something with a fairly significant risk involved.
https://foswiki.org/Support/Faq72
0
Mike KristensenIT administratorAuthor Commented:
But mediecenter is a network drive. Where all clients have access.
A local NAS server, that should be accessed through the network path in Windows 10.

If i do the below, then it still wont go to that location, if it isent pasted into the address bar.
<a href="file:///\\mediecenter\medie center">yourfile.pdf</a>

Open in new window


Even if i do what Chris says, i wont be able to click the link. It is just dead and does not respond at all.
<a href="file:///X:/yourfile.pdf">yourfile.pdf</a>

Open in new window

0
Mike KristensenIT administratorAuthor Commented:
It is ridicules. I'm just forwarding them to there own local path. How can that make a security risk?

Its just a simple link to there own PC folder path. Its not even online.
0
ChrisSr. Systems EngineerCommented:
what browser are you using?
Do you get any different results using different browsers?
0
Mike KristensenIT administratorAuthor Commented:
When i use Edge (Which i plan), it opens the local path system (sry i dont know this name).
This is only if i paste it to address bar.

Firefox and Chrome opens the link in the browser window. This is not the best solution, because there are different kind of file types that browsers cant open. The best thing is the Edge way, which is super perfect and a very powerful and smart solution.
0
masnrockCommented:
You also have to bear in mind the level of integration that Edge and Internet Explorer have with Windows, where they have access to Windows Explorer AND are only designed for Windows. IHowever, but their very nature of being cross platform and not being Microsoft products, you're not going to get Chrome or Firefox able to do things the same way.

I know you cited that this did not work:
<a href="file:///\\mediecenter\medie center">yourfile.pdf</a>

Open in new window


However, this should:
<a href="file:///\\mediecenter\medie%20center">yourfile.pdf</a>

Open in new window


The key difference is the fact that the space was encoded in the URL reference.
1
Mike KristensenIT administratorAuthor Commented:
True. But it wont work.

This dont work:
<a href="file:///\\mediecenter\medie%20center">yourfile.pdf</a>

Open in new window


If you paste it, it works.
If you right click a the link and add it to your reading list, then you can access it there.
But i cant click the link and make it open up the folder.
0
Mike KristensenIT administratorAuthor Commented:
The problem happens as soon as it is not locally triggered.

I assume clicking a link on a website, does not qualify as being local.
But as soon as you paste it into the address bar, then its locally triggered.
And if you add it to your local reading list in Edge, then its local as well.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ChrisSr. Systems EngineerCommented:
Hi Mike,
Like I indicated, I believe this is a browser problem. I believe this is functionality that some browsers have already eliminated, and others are working towards eliminating.
There isn't anything wrong with how you are formatting the URL:
<a href="file:///\\mediecenter\medie%20center">yourfile.pdf</a>

Open in new window


Its that the browser is not longer supporting the ability to open local links from a webpage. I understand you can do it directly, for now.. however, I believe, they will eliminate the ability to do that as well in the near future.

The only solution I have seen that seems to work was to map a virtual directory in IIS to the networked drive with the documents, so the url became a friendly "http://" address.

Setting virtual directories:

IIS:

http://www.iis.net/configreference/system.applicationhost/sites/site/application/virtualdirectory

Apache:

http://w3shaman.com/article/creating-virtual-directory-apache
0
Mike KristensenIT administratorAuthor Commented:
I didnt do anything about it.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.