Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to create a text HTML link to local document

In some of the help answers I see there are links that if you click on them will open up a folder on my system. They can't know the user name on my computer so how do they create a link that will open up that directory:


I tried variations of:


file:///$HOME/Library/Application\ Support/AddressBook/


But this did not work.


iMac 27″, macOS 10.15

Posted on Sep 7, 2021 4:14 PM

Reply
Question marked as Best reply

Posted on Sep 8, 2021 8:46 PM

After going down the rabbit hole from some of your links, I've found that the ability to handle these file URIs lies in the application. Some apps – Stickies, TextEdit – are programmed to handle them, while others – Pages – are not. Finder apparently does not have this inbuilt ability. And apparently the apps that can handle these are restricted by pathname limitations as you've discovered.


It appears that this may be somehow tied into the security of macOS. If links can be distributed to the masses that require just a simplified path to a user's sensitive files and folders, that would potentially be an highly exploitable weakness.


Of course, we know that a lot of things can be accomplished from Terminal that cannot be done from Finder or other apps, so that's not a surprise.


I don't know an answer to the question of a universal shortcut for the home folder.

But I wish you luck, my friend. I'll be following this.

13 replies
Question marked as Best reply

Sep 8, 2021 8:46 PM in response to johnnyjackhammer

After going down the rabbit hole from some of your links, I've found that the ability to handle these file URIs lies in the application. Some apps – Stickies, TextEdit – are programmed to handle them, while others – Pages – are not. Finder apparently does not have this inbuilt ability. And apparently the apps that can handle these are restricted by pathname limitations as you've discovered.


It appears that this may be somehow tied into the security of macOS. If links can be distributed to the masses that require just a simplified path to a user's sensitive files and folders, that would potentially be an highly exploitable weakness.


Of course, we know that a lot of things can be accomplished from Terminal that cannot be done from Finder or other apps, so that's not a surprise.


I don't know an answer to the question of a universal shortcut for the home folder.

But I wish you luck, my friend. I'll be following this.

Sep 8, 2021 11:16 AM in response to johnnyjackhammer

johnnyjackhammer wrote:

In some of the help answers I see there are links that if you click on them will open up a folder on my system. They can't know the user name on my computer so how do they create a link that will open up that directory:

I tried variations of:

file:///$HOME/Library/Application\ Support/AddressBook/

But this did not work.


Maybe you need to be more specific about what, where and with whom you are trying to accomplish...


your request to share </Application\ Support/AddressBook/ > makes no sense to me, to what end(?)


You can set up local file sharing in the >System Preferences

Set up file sharing on Mac - Apple Support




If you have your own server space to share a URL amongst user, it is easy...


alternatives:


—iCloud Use iCloud File Sharing to share folders and documents with ...


—Drop box is one free serves that offers server space where you can share your html link to specific files.

https://www.dropbox.com/business/plans-comparison


Sep 8, 2021 4:59 PM in response to D.I. Johnson

file:///~/Library/Application Support/AddressBook


Paste this into a text document or a note or a sticky. Make it a link, command K, paste the same text for the link, It doesn't work.

Replace the tilde with /Users/your user name/ and it will work, right?


Question is what can we put in place of the tilde so it's universal, will work on anyone's mac system without having to edit the link text. Or how can this be done differently so we achieve the same outcome.


I believe file:/// is a Finder URI scheme but I could be wrong.


Here is a resource for other Apple applications


Sep 8, 2021 5:53 PM in response to johnnyjackhammer

Okay. I understand where you're trying to go with this.


Oddly, this reference link does not work at all for me on a MBP with Catalina 10.15.7. I've tried many iterations of the link pasted into Pages and get nowhere with it, regardless if I use tilde or specify the path. If I type it into the Finder > Go > Go to Folder... then, yes, obviously it does work and locates the specified folder.


The closest I could come was to trigger Safari to attempt to locate the file, but failing and returning the error "Can't open the page... can't find the server." I got this by deleting "file:///" and specifying the path. Definitely not what you're looking for.


So I wonder, does Finder not handle a file called this way?

I looked at the resource you linked but found nothing useful there.


I think this might be a great question for the folks over in the Developer Forums:

click> https://developer.apple.com/forums/


EDIT - Okay, I did just attempt it from a Stickies note and it works as you described. 🤷🏽‍♂️



Sep 8, 2021 6:10 PM in response to D.I. Johnson

D.I. Johnson,


https://stackoverflow.com/a/67202107

https://stackoverflow.com/questions/18246053/how-can-i-create-a-link-to-a-local-file-on-a-locally-run-web-page

https://en.wikipedia.org/wiki/File_URI_scheme

https://developer.apple.com/forums/search/?q=file+uri+scheme


EDIT: I guess the proper terminology for this is a "hot link"


Also, to see this function from Terminal paste this into Terminal:


open file:///$HOME/Library/Application\ Support/AddressBook

Sep 7, 2021 8:13 PM in response to johnnyjackhammer

When someone asks you to access a folder or file on your mac within the logged in

Users/<username> folder

you will see the ~ (tilde) symbol used, this tells the mac to go to the Users/<username> directory.


For example if I wanted you to navigate to the com.apple.finder.plist file I would ask you

to click once on the Desktop, click Go in the menubar select Go To Folder and enter this text.


~/Library/Preferences/com.apple.finder.plist


press Go

A new Finder window will open with com.apple.finder.plist highlighted.


The mac has been asked to go to the file com.apple.finder.plist which is

contained in the path Users/<username>/Library/Preferences.


The ~ symbol tells the mac to search the logged in users directory.

if you have other users on your mac and want to locate files on their account from your

account you would have to enter the text as


Users/<useraccountname>/Library/Preferences/com.apple.finder.plist



Sep 8, 2021 3:46 PM in response to leroydouglas

leroydouglas,


Thanks, but I read your entire response and nowhere in it does it address the question. I never said I am trying to share anything. I am trying to create a universal link that will open a specific user folder on anyones mac regardless of the user name in the path.


Creating a clickable link that will open up a folder on a mac without having to know a user's name?

A generic link that works for any user?


For this you would need a wildcard character that would stand in for the current user's home folder if the path contains it.


Help uses protocols and links like this for apps.


x-help-action://openApp?bundleId=com.apple.appstore


But that is a link to an app not a directory.


Is there another system protocol that can be accessed for directories?


Please don't tell people there is no point to it after you discover you don't know how or it can't be done. It's condescending.

How to create a text HTML link to local document

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.