最新のページを 3000 秒ごとに強制的に更新したい >> そのため、spfx 拡張機能を開発します >> .ts 内に次のコードを追加しました:-
export default class HelloWorldApplicationCustomizer
extends BaseApplicationCustomizer<IHelloWorldApplicationCustomizerProperties> {
@override
public onInit(): Promise<void> {
Log.info(LOG_SOURCE, `Initialized ${strings.Title}`);
const cssUrl: string = this.properties.cssurl;
const scriptUrl: string = this.properties.scripturl;
if (cssUrl) {
// inject the style sheet
const head: any = document.getElementsByTagName("head")[0] || document.documentElement;
let customStyle: HTMLLinkElement = document.createElement("link");
customStyle.href = cssUrl;
customStyle.rel = "stylesheet";
customStyle.type = "text/css";
const head2: any = document.getElementsByTagName("head")[0] || document.documentElement;
let customScript: HTMLLinkElement = document.createElement("link");
customScript.href = scriptUrl;
customScript.rel = "script";
customScript.type = "text/javascript";
head.insertAdjacentElement("beforeEnd", customStyle);
head2.insertAdjacentElement("beforeEnd", '<META HTTP-EQUIV="refresh" CONTENT="3000">');
}
return Promise.resolve();
}
SPFX を自分のサイトに追加すると、ページは 3000 秒ごとに読み込まれなくなります。そのためhead2.insertAdjacentElement("beforeEnd", '<META HTTP-EQUIV="refresh" CONTENT="3000">');
、何の効果もないようです。正しく適用される customStyle がありますが、何かアドバイスはありますか?