Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to show window title using window.open()?

I want to open a new window using:

window.open('<myfile>.pdf','my window','resizable,scrollbars'); 

The new window opens, but I do not get the title of the window as 'my window'. What could be going wrong?

like image 219
user811433 Avatar asked Nov 08 '11 14:11

user811433


People also ask

How do I get a return value from a Windows Open?

Typically the onclick event on the "Yes" or "Ok" button in the modal dialog looks like this: window. returnValue = true; window. close();

What does window open return?

When window. open() returns, the window always contains about:blank . The actual fetching of the URL is deferred and starts after the current script block finishes executing. The window creation and the loading of the referenced resource are done asynchronously.

What does window Open do in JavaScript?

The open() method opens a new browser window, or a new tab, depending on your browser settings and the parameter values.

How do I hide the address bar in Windows Open?

var winFeature = 'location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes'; window. open('Result. html','null',winFeature); In many solutions, just the location=no attribute can hide the address bar (in both IE & Chrome).


2 Answers

If domain is same then you can change the title of new window

 <script type="text/javascript">     var w = window.open('http://localhost:4885/UMS2/Default.aspx');     w.document.title = 'testing';  </script> 
like image 94
Muhammad Shoaib Avatar answered Oct 12 '22 10:10

Muhammad Shoaib


Here is my solution, please check this out:

var myWindow = window.open('<myfile>.pdf','my window','resizable,scrollbars'); myWindow.document.write('<title>My PDF File Title</title>'); 

Hope I could help.

like image 21
maniootek Avatar answered Oct 12 '22 10:10

maniootek