LoginSignup
1
1

More than 5 years have passed since last update.

CKEditor のキャッシュをクリアする

Posted at

WYSIWYG エディタとして、CKEditor を使っている。

この CKEditor というのは、各種の設定に config.js というのを使うのだが、それを更新した際になかなか設定が反映されなかったので備忘として残しておく。

最初、ブラウザにキャッシュされてるのかなと思って、以下のようにしてけども、キャッシュはクリアされなかった。

<script src="/public/common/ckeditor-4.6.2/ckeditor.js?20170619"></script>

ググってみると、どうやら CKEDITOR.timestamp という専用 API を呼ばないといけないらしい。
これでキャッシュがちゃんとクリアされ、設定が反映される。

$(function() {
  CKEDITOR.timestamp = '20170619';
  CKEDITOR.replace('body');
});

Resource versioning とかをフレームワークとかに任せちゃってると、うっかり反映されてなかったとかあるので注意が必要。

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1