Greasy Fork is available in English.

Diskussionen » Entwicklungsanfragen

请问有什么办法把网页中的 h1 添加 document.title ? 并且只要被更改都能保持页面的h1在前面?

§
Veröffentlicht: 15.10.2022

这个需求是因为想保存一些pinterest之类的标签页到ontTab,但是pin的标签标题没有内容里面的标题,所以需要这样一款脚本。

我尝试过这样做,但是过稍微一会就会被页面自己更改回去,请指教。

window.onload=function(){
  document.title=document.querySelectorAll('h1')[0].innerText+' | '+document.title
}
§
Veröffentlicht: 19.12.2022

我是纯小白 不知道是不是能用

Object.defineProperty(document,'title',{set: ()=>null})

之类的代码禁止网站更改?

Antwort schreiben

Anmelden um eine Antwort zu senden.