瀏覽器開始離線工作時在 HTML 中執行指令碼?
當 Web 瀏覽器開始離線工作時,觸發onoffline 屬性。你可以嘗試執行以下程式碼來實現onoffline 屬性 −
示例
<!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