Hi All

Could anybuddy tell me how to rename/hide the title in the popup window. I found the below code from google. this code is working fine. Actualy I don't want to show the url to the user. Below code helps to hide the address bar. But still user can see the url in title bar. If I add the titlebar=no in the var feature then also it is showing the url in titlebar.

Kindly help me.

function loadMainWindow() 
   var win = window.self; 
   win.opener = window.self; 
   var newloc = '<%= url %>'; 
   var ih = (window.window.screen.availHeight - 60) - 100; 
   var iw = (window.window.screen.availWidth - 10) - 100; 
   var it = ((window.window.screen.availHeight - 60) - ih) / 2; 
   var il = ((window.window.screen.availWidth - 10) - iw) / 2; 
   var features = 
+ ",width=" + iw + ",height=" + ih + ",top=" + it + ",left=" + il + ""; 
   v1 = new Date(); 
   v2 = Date.parse(v1); 
   v3 = "pg" + v2; 
   var oNewWindow = window.open(newloc, v3, features); 




function popUpDocuument() 
      popUpMessage.style.display = 'block'; 


Recommended Answers

All 8 Replies

That code is not working on anybody's browser except yours
all recent browsers include popup blockers, you get flagged as a 'bad site'
try using a fixed position div and making it visible or invisible at need.

code snipped, styles set in external stylesheet enough dragged in to make it 'understandable'

<!-- doctype etc html head -->
<script language="javascript" type="text/javascript">
(document.getElementById) ? dom = true : dom = false;
function hideIt() {
 if (dom) {document.getElementById("layer1").style.visibility='hidden';} //ie gecko
 if (document.layers) {document.layers["layer1"].visibility='hide';} } //mozilla ff
function showIt() {
 if (dom) {document.getElementById("layer1").style.visibility='visible';}
 if (document.layers) {document.layers["layer1"].visibility='show';} }
<button onClick="showIt();">Important Information</button>
<div id="layer1" style="position:fixed; left:20px; width:45%; top:20px; visibility:hidden;">
<table border="0" cellspacing="0" cellpadding="3">
<tr><td Align="right" onClick="hideIt()">
<font color="#ffffff"><Strong>Close</strong></font></td></tr>
<tr><td>important stuff you want em to see</td></tr>
<tr><td align="right" onClick="hideIt()"><font Color="#ffffff"><Strong>Close</strong></font></td></tr>

Hi almostbob

Thanks for the response.
I am using internet explorer version 6. The code, which I posted, is working fine. Even I tested this code in internet explorer version 7 also.

Let me explain my question again. I am displaying the file content (file which exists in content management server) in a popup window. I don't want to show the url to the user.
Now I am able to hide address bar but it is still showing the url in titlebar.

As per my understanding, I can't hide the titlebar but we can change the url(title) in titlebar.

Please guide me if I am wrong.


Repeated:: Do Not use Popup Windows, they will be blocked by popup blockers ::
That code Does NOT work on anybody's browser except Yours because everybody else will block your popup windows especially popups that attempt to hide their location, Big RED flags possible malware - or how to get blacklisted 101
Popup will not be seen the information will not be read.

Use a div and hide unhide it as necessary
The div can be any size required and can contain any source required, precisely the same as a popup window, but the div has no displayed uri, and does not trigger popup blockers or any other antimalware scanners

example given in prior post

(And I was even POLITE about it)

Hi almostbob

I added your code into my jsp page. it is showing one button "importtant information". When I click on this button it is showing some script error ("object expected").

<%@ taglib uri="/tags/struts-html" prefix="html" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml">
  <meta name="generator" content="HTML Tidy for Windows (vers 1st July 2003), see www.w3.org" />


<button onClick="showIt();">Important Information</button><div id="layer1" style="position:fixed; left:20px; width:45%; top:20px; visibility:hidden;"><table border="0" cellspacing="0" cellpadding="3"><tr><td Align="right" onClick="hideIt()"><font color="#ffffff"><Strong>Close</strong></font></td></tr><tr><td>important stuff you want em to see</td></tr><tr><td align="right" onClick="hideIt()"><font Color="#ffffff"><Strong>Close</strong></font></td></tr></table></div>


<script language="javascript" type="text/javascript">(document.getElementById) ? dom = true : dom = false;function hideIt() { if (dom) {document.getElementById("layer1").style.visibility='hidden';}  if (document.layers) {document.layers["layer1"].visibility='hide';} } mozilla fffunction showIt() { if (dom) {document.getElementById("layer1").style.visibility='visible';} if (document.layers) {document.layers["layer1"].visibility='show';} }</script>

I am very poor in java script. I need some code help.


The attached archive contains a demo file, with no typos
( I dont trust my typing NEmore so its one that does work )
the table cell class='bottom' can contain any other html or iframe or php include, this is just a demo, sizes are adjustable etc

Hi almostbob,

Thanks for your continuous help.
Actualy according to your code, if we click on "Important Information" button, it display the content under <div> tag.

But in my application, I have given links for download. user can directly download the file(jpeg, doc, pdf etc.) from the content management server. I am not using input/output stream. I am using url addressability approach given by content management server. I just open the file in popup window using url.

My application is working fine. I am able to see the content in popup window. But I don't want to show the url to the user.
I am able to hide address bar, toolbar, statusbar except titlebar.
Now I want to rename the tile of titlebar of popup window. Please tell me is it possible or not.

Even you repeated two times that don't use popup windows, they will be blocked by popup blockers. If user block the popup window that is not my problem.

Now pls let me know how your approach is suitable for my application.


a <div> can be replaced with, or filled with, anything else, so the invisible field can contain anything

if you dont care this 'stuff' that is so important will be invisible to more than can see it
and that anyone can pull the uri from your window whether you display it or not


But Bob tell me how can I use this approach for my application. I create the url (url given by server API) to the file and just open that file.

Now question is how will I display the file content using <div>.
I am not reading the file content. Because file reading and writing is a time consuming approach.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.