I have an HTML page. The aim is to set the <title>
tag dynamically.
Using this Ajax call to get data to be inserted inside title tag as below
$.get("/" + $.flydubai.config.CurrentLanguageCode + "/error/PageTitle/", function (data) {
document.title = data;
});
Now, I want to update not the browser title but the HTML <title></title>
tag itself. Is it even possible? I tried these:
document.getElementById('ttl').innerHTML = 'World';
ttl.innerHTML = 'world';
document.getElementsByTagName('title')[0].innerHTML = 'world';
document.querySelector.apply(document,['title']).innerHTML = 'world';
document.querySelectorAll.apply(document,['title'])[0].innerHTML = 'world';
These all will change only the client side (i.e., browser title).