此函數會在目前的頁面 HTML <head> 標記中建立一個 link 元素。來源會設為 cssUrl 的路徑。
參數
注意:
Oracle 並未正式支援 Utils 命名空間中的函數。它們主要作為範例實行使用。若使用這些函數,需自行承擔風險。| 名稱 | 類型 | 描述 |
|---|---|---|
|
|
字串 |
目前主題設計的 URL 路徑。只能搭配遠端元件使用。 本機元件 (顯現於 iframe 中) 必須從頁面 (而非 URL) 擷取特性。 |
用法
此函數通常用於從主機網站擷取目前的主題設計時,如本範例程式碼所示:
// fetch current theme design from host site and then add it to the page
SitesSDK.getSiteProperty('theme',function(data){
// check if we got an url back
if ( data.url && typeof data.url === 'string' ) {
if ( data.url !== '') {
// theme is loaded so dynamically inject theme
SitesSDK.Utils.addSiteThemeDesign(data.url);
}
}
});