Just a quickie..
If I set on an alert document.title to “ALERT” per say.
Then want to set it back afterwards is there an ezmode way to do this or will it be setting an ID on the link tags to set the title back to the ID. Note its an external script that is used on 20+ pages.
Your question is a bit unclear because it starts talking about links and such. But you do specifically mention
document.title, so…If you set
document.title, there’s no way to set it back to its previous value without your saving the previous value and then restoring it, e.g.:(Ideally, instead of clearing the
previousTitlewithdocument.previousTitle = undefined;, we’d usedelete document.previousTitle;, but sadly that breaks on IE becausedocumentisn’t really a JavaScript object, it just behaves very much like one, mostly.)You might think: Let’s go find the
titleelement in theheadand use its original content to restore the title. (That’s what I thought.) But no, settingdocument.titleactually updates the content of thetitleelement in thehead, so that doesn’t work. You have to save the original somewhere else.