I would like to be able to add the file://
protocol to the list of filter_protocols
so that we can add links to shared company files on a mapped drive from within our intranet website, but I'm not sure how to do this. Right now, it is apparently not included, according to Link Module Overview. Is there a way to manually configure this list in order to add file://
?
Add a comment
|
1 Answer
You can override that in a container services file.
For example, create/edit /sites/default/services.yml, and add/alter the following lines:
parameters:
filter_protocols:
- http
- https
- ftp
- news
- nntp
- tel
- telnet
- mailto
- irc
- ssh
- sftp
- webcal
- rtsp
- file
and make sure you have this line uncommented/added to settings.php:
$settings['container_yamls'][] = $app_root . '/' . $site_path . '/services.yml';
-
Hmm. I tried that and it unfortunately did not work for me. In my
sites/default/
directory i have two files besides my newly createdservices.yml
file and the preexistingsettings.php
file:default.services.yml
anddefault.settings.php
. I edited both of these default files in the same way you described above for the non-defaultsettings.php
andservices.yml
. When I click on my html link on my web-page,<a href="file://C:/Users/AdamNoack/Desktop/test1.docx">local file</a>
nothing happens. I have tried many different variations of thisa
tag and nothing seems to work. Commented Jun 18, 2018 at 15:51 -
1Is it on a local domain? Some browser security policies disallow embed/redirect to file:// protocol for local domains. If that's the problem it's not one Drupal can help to solve; Drupal's only involvement is rendering the
file:///
URL in the first place– Clive ♦Commented Jun 18, 2018 at 15:59 -
1Oh you're right! It now at least works in IE. Doesn't work in chrome though. Thank you! Commented Jun 18, 2018 at 16:08
-
2It works in chrome with this chrome extension: enable local file links Commented Jun 18, 2018 at 18:32
-
+1 this is an awesome answer. For my project I needed to have WhatsApp symbol as a menu link within a standard Drupal menu. fontawesome_menu_icons solved the visual - provided a WhatsApp symbol, along with menu_link_attributes for styling. 1 / 2 Commented Dec 15, 2020 at 0:52