Search code examples
javascriptnvda

how to set window title in a webpage


is there any possible way to set document window title.I've a webpage, in that webpage we are loading Iframe(which is from another project).By default it is taking current webpage title.how can I override the title with with current Iframe page title.


Solution

  • I think this is what you are looking for. Get the title for the iframe in whatever manner works best for you and then set the document title using:

    document.title = "New Title"
    

    If you don't know how to get the iframe title, try something along these lines:

    document.title = document.getElementById("main-content-iframe").contentDocument.title;