I am trying to open a new url page and get the title of new page

63 Views Asked by At

I am trying to open a new url page and get the title of new page.

issue: it is openning new page but the title is for previous page, (not new page).

 // open pdf in new window page 
        var url = 'http://myserver/mywebsite/Files/folder12/folder3/myfile.pdf';
        location.href = url;

        //get the title of new page 
        var title = $('title').text();

        //display new page title
        alert(title);
1

There are 1 best solutions below

0
On

I think the problem you have is the new webpage is not a real page. It's a pdf, you can't get a page title from a pdf file.