Add a link to call by skype in Drupal 8
Websites can use protocol handlers to provide a convenient way for users to open default applications directly from a web page. A common example is a mailto: link for sending an email:
<a href="mailto:info@example.com">info@example.com</a>
When the link is activated, the browser should launch the default email application.
This is becoming even more popular with the proliferation of touch devices like smartphones and tablets. Instead of typing e.g. a long phone number from a web page, the user can call that number by simply clicking on it:
<a href="tel:+1234567890">+1 234 567 890</a>
Drupal limits the allowed protocols. If you use a text filter that strips certain HTML tags, protocols that are not allowed get filtered out. There is no administration page in Drupal core where you could add more protocols to the list.
In Drupal 7 the contributed module Filter allowed protocols provides such an administration page. Or you can add protocols directly in the file /sites/default/settings.php:
<?php
$conf['filter_allowed_protocols'] = array('ftp', 'http', ...);
In Drupal 8 you can add protocols by editing the default filter protocols list in the file /sites/default/services.yml:
parameters:
# Allowed protocols for URL generation.
filter_protocols:
- http
- https
- ftp
- news
- nntp
- tel
- telnet
- mailto
- irc
- ssh
- sftp
- webcal
- rtsp
- skype
This allows to create a link that visitors can click on to call a skype user (replace the text in brackets with a valid skype user name):
<a href="skype:<username>?call">Skype user name</a>
Comments
Thank you!
thanks a lot! saved my day
You're a life saver
You're a life saver
Add new comment