This is set in a Scriptrunner Fragment:

String DIV ="<div id=changed></div>"
String JS = """<script type='application/javascript'>
 
        let timeout = undefined;
        let cacheValue = undefined;

        document.getElementById('issue-updated_heading').style.display = 'none';
 
        poller = (issueKey) => {
            let url = 'https://jira.netic.dk/rest/api/2/issue/' + issueKey + '?fields=updated';
            let issue = 'https://jira.netic.dk/browse/' + issueKey
            fetch(url)
                .then((response) => {
                    return response.json()
                })
                .then((data) => {
                    let val = data.fields.updated;
                    if (val != cacheValue){
                        if (cacheValue !== undefined){
                            let elem = document.getElementById('changed');
                            elem.innerHTML ='<a href=\"' + issue + '\" class=\"aui-button toolbar-trigger aui-button-primary\">The Issue has been updated. Click to Reload</a>';
                            var title = document.title;
	                        document.title = '(Updated) ' + title;
                        }
                        cacheValue = val;
                    }
                })
                .then(() => {
                    clearTimeout(timeout);
                    timeout = setTimeout(() => { poller(issueKey) }, 5000)
                })
                .catch(error => {
                    console.error('Error fetching data:', error);
                });
        }
 
        poller(document.getElementsByTagName('meta')["ajs-issue-key"].content);
    </script>"""

writer.write (DIV + JS)