Linking to a file on my computer

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Post Reply
xjustmaaike
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Jun 12, 2018 9:17 pm

Linking to a file on my computer

Post by xjustmaaike » Tue Jun 12, 2018 9:23 pm

Hi everyone,

I have a question and I couldn't find the answer on this forum or at other websites.

I would like to link in a menu item (external link) to a file or map on my own computer. I have a Mac and I am using chrome. I've tried to link to: "file:///Users/map/document". When I type this in a new website page it works and it opens the map. But when I put it in an external link in a menu item in Joomla it doesn't open.

Does anyone have a solution for my problem? Maybe an extension that could be working?

Thanks!

Maaike

User avatar
sozzled
Joomla! Champion
Joomla! Champion
Posts: 5335
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: Linking to a file on my computer

Post by sozzled » Tue Jun 12, 2018 9:34 pm

No, you can't link a URL on a website to a "file" on your PC. It's not a Joomla "thing"; it's an internet security thing. Imagine: if any website on the internet could connect to anyone's PC, then anyone on the internet could discover all kinds of personal information that people store on their PCs! :eek:

The only way that you could possibly use the construct that you're using (on a "new website", as you described it) is if the "new website" is also located on your PC. I guess your "new website" is not a real website; it's a locally-hosted website (e.g. XAMPP or something like that) that's not on the internet?

Copy the map/image to your website and link it there using the standard <img src="path/filename.ext" /> HTML tag.
https://www.kuneze.com/blog
Former member of Kunena project team
If you think I’m wrong then say “I think you're wrong.” If you say “You’re wrong!”, how do you know?

xjustmaaike
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Jun 12, 2018 9:17 pm

Re: Linking to a file on my computer

Post by xjustmaaike » Wed Jun 13, 2018 11:06 am

I am sorry I missed your last line at the reply. I am going to try it while using img src instead of a href.
Update: tried it. But I want to open the file in a new tab...

-----

Hi Sozzled,

Thanks for the reply! That is some bad news... I hope there is still a way.

It isn't a 'real website' it is a locally-hosted website in MAMP. I made it for a client and they are going to use it as a dashboard intern. They have shared documents whom they using every day so I wanted to link to these documents with "file:///Users/map/document".

The 'website/dashboard' is now on my locally-hosted server MAMP, also the file where I want to link at is on my computer. When I click at inspect I see a good path in the href in <a>. But when I click at this link there is opening a new page with about:blank.

Maaike

User avatar
sozzled
Joomla! Champion
Joomla! Champion
Posts: 5335
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: Linking to a file on my computer

Post by sozzled » Wed Jun 13, 2018 11:21 am

Short answer: won't work. You can't make a real website link the target of an anchor tag (i.e. <a href="protocol://path/filename.ext">) to a file on a someone's PC.

Copy the files you need to the website and link the target to the file's relative location. Simple.
https://www.kuneze.com/blog
Former member of Kunena project team
If you think I’m wrong then say “I think you're wrong.” If you say “You’re wrong!”, how do you know?

KianWilliam
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 153
Joined: Thu Jan 12, 2017 10:13 am

Re: Linking to a file on my computer

Post by KianWilliam » Wed Jun 13, 2018 11:26 am

I know it is possible to access local server from external servers( specially in LAN), you have to put your file map under your local server and make a new configuration in apache for that to be possible.
Kian William

User avatar
fcoulter
Joomla! Ace
Joomla! Ace
Posts: 1630
Joined: Thu Sep 13, 2007 11:39 am
Location: UK
Contact:

Re: Linking to a file on my computer

Post by fcoulter » Wed Jun 13, 2018 11:35 am

Short answer: won't work. You can't make a real website link the target of an anchor tag (i.e. <a href="protocol://path/filename.ext">) to a file on a someone's PC.
I am not 100% sure that this is correct, this seems to hint that you can use a protocol such as file: for a valid URI https://www.w3schools.com/tags/att_a_href.asp.

What you could do though, rather than worrying about that is to use a localhost URI, eg

http://localhost/path/to/file.doc

You would need to store the file inside the web root, ie inside the htdocs folder.
http://www.spiralscripts.co.uk for Joomla! extensions
http://www.fionacoulter.com/blog my personal website
Security Forum moderator :: VEL team member
"Wearing my tin foil hat with pride"

User avatar
fcoulter
Joomla! Ace
Joomla! Ace
Posts: 1630
Joined: Thu Sep 13, 2007 11:39 am
Location: UK
Contact:

Re: Linking to a file on my computer

Post by fcoulter » Wed Jun 13, 2018 12:31 pm

Here you go, an explanation of how to use the file: protocol to access local files: https://en.wikipedia.org/wiki/File_URI_scheme

However I don't know how you would actually get it to open in a web page, so I am not sure what use it is. If you want to open it in a web browser I think that you would need to use

http://localhost/path/to/file.doc

as I mentioned above
http://www.spiralscripts.co.uk for Joomla! extensions
http://www.fionacoulter.com/blog my personal website
Security Forum moderator :: VEL team member
"Wearing my tin foil hat with pride"

xjustmaaike
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Jun 12, 2018 9:17 pm

Re: Linking to a file on my computer

Post by xjustmaaike » Wed Jun 13, 2018 2:45 pm

Thanks all!

I can try with my client if they want the files in the same root as the intern website. But I think the answer would be no...


Post Reply

Return to “Extensions for Joomla! 3.x”