TinyMCE 對於同 domain 以 http 開頭的絕對網址,預設會雞婆地作 url 相對路徑的轉換
TinyMCE 提供 3 + 1 組選項設定,可供自由運用組合。
當 convert_urls 為 true 時 (預設值),底下 3 組可交互使用
relative_urls 布林值,預設為 true
remove_script_host 布林值,預設為 true
document_base_url 字串值,預設為當前程式的路徑
或單獨將 convert_urls 設定為 false 關閉網址轉換
參考:Paths/URLs are incorrect, I want absolute/relative URLs?
http://tinymce.moxiecode.com/wiki.php/TinyMCE_FAQ#Paths.2FURLs_are_incorrect.2C_I_want_absolute.2Frelative_URLs.3F
參考:URL conversion
http://tinymce.moxiecode.com/tryit/url_conversion.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
<script type="text/javascript"> // 對於同 domain 的網址或圖片連結,會以根目錄 / 作為開頭 // TinyMCE with absolute URLs on links and images tinyMCE.init({ relative_urls: false }); // 對於同 domain 的網址或圖片連結,以完整 http 絕對網址開頭 // TinyMCE with absolute URLs and including domain on links and images tinyMCE.init({ relative_urls: false, remove_script_host: false }); // 此為預設值:自動轉換同 domain 的網址或圖片連結,為相對於當前程式的路徑 // TinyMCE with relative URLs on links and images tinyMCE.init({ relative_urls: true // Default value }); // 以指定好的 base url 為基礎相對位置,自動轉換同 domain 的網址或圖片連結 // TinyMCE with relative URLs on links and images to a specific page tinyMCE.init({ relative_urls: true, // Default value document_base_url: 'http://tinymce.moxiecode.com/' }); // 不作任何 url 轉換 // TinyMCE with no url convertion tinyMCE.init({ convert_urls: false }); </script> |
在設定網址或圖片連結時,以「絕對路徑 + convert_urls: false」看來是最保險的組合,
但也相對就失去 domain 轉換時的彈性就是。
但也相對就失去 domain 轉換時的彈性就是。
相關文章 Related posts:


