我可以从网页的第一次加载到关闭做一行代码 运行 吗?

Can i make a line of code run from the first load of the webpage until closing?

在javascript中,如果我把

console.log("hello world")

它只会在页面加载时将“hello world”记录到控制台 1 次。我能否使此代码 运行 不仅仅是 1 次,而是直到网页关闭?

while (1) console.log("Hello, World!");