浏览器开始脱机工作时在 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