js 跳轉頁面後自動觸發一個點擊事件

例如:接入七魚客服

實現: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>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章