<a> is automatically trimmed in cakePHP post method

时间:2018-03-20 09:36:00

标签: html forms post tinymce cakephp-3.0

I'm trying to submit a form which consists of text fields and tiny mce editor. The tiny mce editor contains raw html elements like this

<a href="http://testserver/my-development-app/web/users/profile/4567/3323" target="_blank">View Profile</a>

After submitting the form via POST method using cakePHP, the href attribute of anchor tag value is automatically trimmed like this

<a href="../profile/4567/3323" target="_blank" rel="noopener noreferrer">View Profile</a>

What is wrong here? Why the href attribute url is trimmed after submitting the form ?

2 个答案:

答案 0 :(得分:1)

您需要配置 tiny mce编辑器来处理网址。确保在你正在使用的javascript初始化中,你有这些行:

relative_urls : false,
remove_script_host : false,
convert_urls : true,

答案 1 :(得分:0)

您需要将relative_urls设置为false。默认情况下,TinyMCE将假定所有链接都与编辑器相关。