on 2020 Jan 30 8:58 AM
I'm getting a block of msgs from a CMS api to display using FormattedText and they have email links in it.
html tag <a> was mentioned supported in FormattedText. But if tried with href="mailto:jo@gmail.com", the rendered view becomes href="#".
https://sapui5.hana.ondemand.com/test-resources/sap/m/FormattedText.html
Replace it with below:
<a href="mailto: jo@gmail.com">jo@gmail.com</a>
And click update. Now if you inspect the link, you will see it like this:
<a href="#" target="_blank">jo@gmail.com</a>
So HTML mailto link doesn't work in FormattedText. Can someone help guide how to go around with this bug?
Request clarification before answering.
I know I am late, but I also struggled and almost opened an incident when I finally found the solution.
So basically FormattedText only allows https and ftp protocol. If you want mailto, you have to add it to the whitelist.
At the beginning of your controller (or even better your Component.js) import
"sap/base/security/URLWhitelist"
Then early on (I suggest onInit) add your protocol to the whitelist.
URLWhitelist.add("mailto");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
57 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.