Search code examples
filehyperlinktypo3content-management-systemlocal

TYPO3 Link to local file like "file:///C:/SomeFile"


I wanted to add a link to a local file, like "file:///C:/dir/some/file.pdf", in TYPO3. I can add the link in the backend-text editor moreover; when I display the source-code, the Link is correct. However, in the frontend the url of this same link is missing in the html-code which means the browser won't display it as a link (obviously because it is not a valid link at this point).

Example code in the backend:

<a href="file:///N:/Path/links/link/">Link-Name</a></p>

Result in the front end:

<a target="_blank">Link-Name</a>

Do any of you have an idea how I can fix this problem?

Souji


Solution

  • If you want to add a file:/// link in the Rich Text Editor (htmlarea) of TYPO3 up to 7.6, you need to add the parameter rtekeep="1" to the link, e.g. like this:

    <a href="file:///N:/Path/links/link/" rtekeep="1">Link-Name</a>
    

    As far as I know this doesn't work in TYPO3 8.7 and newer versions which use a new Rich Text Editor called CKEditor.

    By the way, not all browsers support the file:// protocol anymore.