LoginSignup
2
3

More than 5 years have passed since last update.

UpUp.jsで簡単にオフライン時のページを用意する

Last updated at Posted at 2017-09-13

参考

準備

https://github.com/TalAter/UpUp/releases から
https://github.com/TalAter/UpUp/archive/v0.3.0.zip
をダウンロード。

UpUp-0.3.0/demo/ 内から以下を取得

  • upup.min.js
  • upup.min.js.map
  • upup.sw.min.js
  • upup.sw.min.js.map

サンプル

1.html
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="/upup.min.js"></script>
<script>
    UpUp.start({'content-url': 'offline.html'});
</script>
</head>
<body>
通常のページ
</body>
</html>
offline.html
<head>
<meta charset="utf-8">
</head>
<body>
<pre>
インターネットに接続できていない可能性があります。

次の内容を確認してください。

* ケーブルがしっかり接続されていること

* ブロードバンドルーターの電源をOFF/ONして1分ほど経ってから
  再度ページを開き直してください。

</pre>
</body>
</html>

表示例

オンライン時

スクリーンショット_2017-09-13_14-51-51.png

オフライン時

offline.png

スクリーンショット_2017-09-13_15-40-52.png

2
3
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
2
3