How to rename/hide the title of the popup window

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Dec 2008
Posts: 17
Reputation: nishantdaniweb is an unknown quantity at this point 
Solved Threads: 0
nishantdaniweb nishantdaniweb is offline Offline
Newbie Poster

How to rename/hide the title of the popup window

 
0
  #1
Feb 24th, 2009
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.

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1.  
  2. function loadMainWindow()
  3. {
  4. var win = window.self;
  5. win.opener = window.self;
  6. var newloc = '<%= url %>';
  7. var ih = (window.window.screen.availHeight - 60) - 100;
  8. var iw = (window.window.screen.availWidth - 10) - 100;
  9. var it = ((window.window.screen.availHeight - 60) - ih) / 2;
  10. var il = ((window.window.screen.availWidth - 10) - iw) / 2;
  11.  
  12. var features =
  13. "directories=no,menubar=no,location=no,toolbar=no,status=no,scrollbars=yes­,resizable=yes"
  14. + ",width=" + iw + ",height=" + ih + ",top=" + it + ",left=" + il + "";
  15. v1 = new Date();
  16. v2 = Date.parse(v1);
  17. v3 = "pg" + v2;
  18.  
  19. var oNewWindow = window.open(newloc, v3, features);
  20.  
  21.  
  22. oNewWindow.focus();
  23.  
  24.  
  25.  
  26.  
  27. }
  28.  
  29. function popUpDocuument()
  30. {
  31. try
  32. {
  33. loadMainWindow();
  34. }
  35. catch(e)
  36. {
  37. popUpMessage.style.display = 'block';
  38. }
  39. }

Regards
Nishant
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,305
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 161
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: How to rename/hide the title of the popup window

 
0
  #2
Feb 24th, 2009
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'
  1. <!-- doctype etc html head -->
  2. <script language="javascript" type="text/javascript">
  3. <!--
  4. (document.getElementById) ? dom = true : dom = false;
  5. function hideIt() {
  6.  if (dom) {document.getElementById("layer1").style.visibility='hidden';} //ie gecko
  7.  if (document.layers) {document.layers["layer1"].visibility='hide';} } //mozilla ff
  8. function showIt() {
  9.  if (dom) {document.getElementById("layer1").style.visibility='visible';}
  10.  if (document.layers) {document.layers["layer1"].visibility='show';} }
  11. //--></script>
  12. </head>
  13. <body>
  14. <button onClick="showIt();">Important Information</button>
  15. <div id="layer1" style="position:fixed; left:20px; width:45%; top:20px; visibility:hidden;">
  16. <table border="0" cellspacing="0" cellpadding="3">
  17. <tr><td Align="right" onClick="hideIt()">
  18. <font color="#ffffff"><Strong>Close</strong></font></td></tr>
  19. <tr><td>important stuff you want em to see</td></tr>
  20. <tr><td align="right" onClick="hideIt()"><font Color="#ffffff"><Strong>Close</strong></font></td></tr>
  21. </table>
  22. </div>
  23. </body>
  24. </html>
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 17
Reputation: nishantdaniweb is an unknown quantity at this point 
Solved Threads: 0
nishantdaniweb nishantdaniweb is offline Offline
Newbie Poster

Re: How to rename/hide the title of the popup window

 
0
  #3
Feb 24th, 2009
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.

Regards
Nishant
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,305
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 161
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: How to rename/hide the title of the popup window

 
0
  #4
Feb 25th, 2009
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)
Last edited by almostbob; Feb 25th, 2009 at 1:20 am.
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 17
Reputation: nishantdaniweb is an unknown quantity at this point 
Solved Threads: 0
nishantdaniweb nishantdaniweb is offline Offline
Newbie Poster

Re: How to rename/hide the title of the popup window

 
0
  #5
Feb 25th, 2009
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").

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <%@ taglib uri="/tags/struts-html" prefix="html" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  4. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head>
  7. <meta name="generator" content="HTML Tidy for Windows (vers 1st July 2003), see www.w3.org" />
  8.  
  9. <title>Home</title>
  10. </head>
  11.  
  12. <body>
  13. <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>
  14.  
  15. </body>
  16. </html>
  17.  
  18.  
  19. <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.

Regards
Nishant
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,305
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 161
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: How to rename/hide the title of the popup window

 
0
  #6
Feb 25th, 2009
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
Attached Files
File Type: zip demohome.zip (1.0 KB, 13 views)
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 17
Reputation: nishantdaniweb is an unknown quantity at this point 
Solved Threads: 0
nishantdaniweb nishantdaniweb is offline Offline
Newbie Poster

Re: How to rename/hide the title of the popup window

 
0
  #7
Feb 26th, 2009
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.



Regards
Nishant
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,305
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 161
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: How to rename/hide the title of the popup window

 
0
  #8
Feb 26th, 2009
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

PLoNK
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 17
Reputation: nishantdaniweb is an unknown quantity at this point 
Solved Threads: 0
nishantdaniweb nishantdaniweb is offline Offline
Newbie Poster

Re: How to rename/hide the title of the popup window

 
0
  #9
Feb 26th, 2009
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.

Regards
Nishant
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC