例如:接入七魚客服
實現:onload
- onload 事件會在頁面或圖像加載完成後立即發生。
- onload 通常用於 <body> 元素,在頁面完全載入後(包括圖片、css文件等等。)執行腳本代碼。
代碼如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>在線客服</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
</head>
<script>
function load() {
document.getElementById("YSF-BTN-HOLDER").click();
}
</script>
<body onload="load()">
</body>
<script src="https://qiyukf.com/script/xxx.js"></script>
</html>