瀏覽器開始離線時在 HTML 中執行指令碼?
當 Web 瀏覽器開始離線時,onoffline屬性會觸發。您可以嘗試執行以下程式碼來實現offoffline屬性
示例
<!DOCTYPE html>
<html>
<body ononline = "onlineFunc()" onoffline = "offlineFunc()">
<script>
function onlineFunc() {
alert ("Working online!");
}
function offlineFunc() {
alert ("Workinf offline!");
}
</script>
<p>Got o the web browser menu bar and click the File menu. Select "Work Offline" and toggle between online and offline.</p>
</body>
</html>
廣告
資料結構
計算機網路
關係型資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP