window.open with no titlebar

  • softstor
  • Novice
  • Novice
  • softstor
  • Posts: 29

Post 3+ Months Ago

I have an application that opens a windowusing window.open. Everything works correctly except for the titlebar. I wish to open this window with no titlebar. I have set 'titlebar=0' and this does not seem to work. Is it possible to open a window to no titlebar or to replace the text of the titlebar?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Mas Sehguh
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1853

Post 3+ Months Ago

Let's do a little thought experiment. Suppose you could open a window with no title bar.

Therefore, the user would not have any control over where the window is placed, because the titlebar is for moving the window around.

Also, the user would have no easy way to close the window. I would be possible by using the taskbar, but since the titlebar is missing, the user would not know what the window is named, so he might close the wrong one.

So, are you sure you want to remove the title bar?
  • softstor
  • Novice
  • Novice
  • softstor
  • Posts: 29

Post 3+ Months Ago

Good point.

What I really want to do is to remove the text that is displayed in the title bar.

Is that possible?
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

The closest you can come is having only a period (or any other char) displayed since leaving the title blank or using spaces will cause the title to default to the address of the page.
Code: [ Select ]
<head>
<title>.</title>
</head>
  1. <head>
  2. <title>.</title>
  3. </head>
  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

Code: [ Select ]
<html>
    <head>
        <title>&nbsp;</title>
    </head>
    <body>
    </body>
</html>
  1. <html>
  2.     <head>
  3.         <title>&nbsp;</title>
  4.     </head>
  5.     <body>
  6.     </body>
  7. </html>


will give you a white space but the name of the browser will still be visible. You can only change this in the registry
  • Mas Sehguh
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1853

Post 3+ Months Ago

And usually, you'll get "- Microsoft Internet Explorer", which, with that hyphen-minus, is just plain ugly :)
  • softstor
  • Novice
  • Novice
  • softstor
  • Posts: 29

Post 3+ Months Ago

How is specifing the title name used by calling window.open?
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Posts: 1098

Post 3+ Months Ago

It's not. You would have to do that in the source of the page you're opening. Are you opening up someone else's page as a popup?
.c
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Posts: 1098

Post 3+ Months Ago

Um... sorry...
After I posted that, I decided to actually see if I could. See code below. I don't have time to perfect it... but this might give you a good place to start. Please post the final code if you (or someone) figures it out.
.c

Code: [ Select ]
<html>
<head>
<title>ORIGINAL TITLE</title>
<script LANGUAGE="JavaScript" TYPE="text/javascript">
function doOpen(){
    WINDOW_HANDLE = window.open("test.html","pagetitle","height=10");
    return WINDOW_HANDLE;
}

function set_title(handle,text){
 /*
     When I omitted the alert, I got an error: "unspecified error"
     Weird... but this worked otherwise

        also, when I put in a remote site, I got an Access Denied error, so this only works on local pages, not remote ones.

 */
    alert(handle.document.title);
    handle.document.title = text;
}
</script>
</head>
<body>
<a HREF="#" onClick="set_title(doOpen(),'new title to use');">Open!</a>
</body>
</html>
  1. <html>
  2. <head>
  3. <title>ORIGINAL TITLE</title>
  4. <script LANGUAGE="JavaScript" TYPE="text/javascript">
  5. function doOpen(){
  6.     WINDOW_HANDLE = window.open("test.html","pagetitle","height=10");
  7.     return WINDOW_HANDLE;
  8. }
  9. function set_title(handle,text){
  10.  /*
  11.      When I omitted the alert, I got an error: "unspecified error"
  12.      Weird... but this worked otherwise
  13.         also, when I put in a remote site, I got an Access Denied error, so this only works on local pages, not remote ones.
  14.  */
  15.     alert(handle.document.title);
  16.     handle.document.title = text;
  17. }
  18. </script>
  19. </head>
  20. <body>
  21. <a HREF="#" onClick="set_title(doOpen(),'new title to use');">Open!</a>
  22. </body>
  23. </html>



*EDIT:

I just realized... the error that comes up with I omit the alert probably happens because the script is trying to access the title attribute of the new window before that window has fully opened, thus the window exists but it's elements are not actually accessible, which IE's JS parser get annoyed about and throws an error. Maybe a while loop that waits until something happens with the new window would work here?
  • softstor
  • Novice
  • Novice
  • softstor
  • Posts: 29

Post 3+ Months Ago

This is the code that I am using:

<script LANGUAGE="JavaScript">
<!--
function openwindow(url, width, height) {
var win;
var windowName;
var params;
windowName = "features";
params = "toolbar=0,";
params += "location=0,";
params += "directories=0,";
params += "status=0,";
params += "menubar=0,";
params += "titlebar=0,";
params += "scrollbars=1,";
params += "resizable=1,";
params += "top=50,";
params += "left=50,";
params += "width="+width+",";
params += "height="+height;
win = window.open(url, windowName, params);
}
// -->
</SCRIPT>



<a href="javascript:openwindow('file.jpg',460,380)">Click here to view jpg</a>
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Posts: 1098

Post 3+ Months Ago

Here is a working example...

But. It will not work if you are not opened a text/html MIME type document.

To make this work the way you want, you will need to create a page that shows the images, not just popup the image up directly. An option for that is below as well. (I've worked it into the code examples)

Opening Page:
Code: [ Select ]
<html>
<head>
<title>Opening Page</title>
<script LANGUAGE="JavaScript" TYPE="text/javascript">
function doOpen(){
    WINDOW_HANDLE = window.open("show_image.php?img=img1","care_global","height=10");
    return WINDOW_HANDLE;
}

function set_title(handle,text){
 /*
     When I omitted the alert, I got an error: "unspecified error"
     Weird... but this worked otherwise

        also, when I put in a remote site, I got an Access Denied error, so this only works on local pages, not remote ones.

 */
//    alert(handle.document.title);
    while(handle.document.title == ""){ sleepy = true; }

    handle.document.title = text;
}
</script>
</head>
<body>
<a HREF="#" onClick="set_title(doOpen(),'new title to use');">Open!</a>
</body>
</html>
  1. <html>
  2. <head>
  3. <title>Opening Page</title>
  4. <script LANGUAGE="JavaScript" TYPE="text/javascript">
  5. function doOpen(){
  6.     WINDOW_HANDLE = window.open("show_image.php?img=img1","care_global","height=10");
  7.     return WINDOW_HANDLE;
  8. }
  9. function set_title(handle,text){
  10.  /*
  11.      When I omitted the alert, I got an error: "unspecified error"
  12.      Weird... but this worked otherwise
  13.         also, when I put in a remote site, I got an Access Denied error, so this only works on local pages, not remote ones.
  14.  */
  15. //    alert(handle.document.title);
  16.     while(handle.document.title == ""){ sleepy = true; }
  17.     handle.document.title = text;
  18. }
  19. </script>
  20. </head>
  21. <body>
  22. <a HREF="#" onClick="set_title(doOpen(),'new title to use');">Open!</a>
  23. </body>
  24. </html>


Popup:

Code: [ Select ]
<html>
<head>
<title>ORIGINAL TITLE</title>
<script LANGUAGE="JavaScript" TYPE="text/javascript">
</head>
<body>

(PUT PHP CODE BELOW HERE)

</body>
</html>
  1. <html>
  2. <head>
  3. <title>ORIGINAL TITLE</title>
  4. <script LANGUAGE="JavaScript" TYPE="text/javascript">
  5. </head>
  6. <body>
  7. (PUT PHP CODE BELOW HERE)
  8. </body>
  9. </html>



PHP Code: [ Select ]
 
<?
 
$image = $_GET["img"];
 
$image_to_show = "/images/".$img.".jpg";
 
?>
 
 
 
<html>
 
<title></title>
 
<img SRC="<?=$image_to_show?>">
 
</html>
 
 
 
 
 
 
  1.  
  2. <?
  3.  
  4. $image = $_GET["img"];
  5.  
  6. $image_to_show = "/images/".$img.".jpg";
  7.  
  8. ?>
  9.  
  10.  
  11.  
  12. <html>
  13.  
  14. <title></title>
  15.  
  16. <img SRC="<?=$image_to_show?>">
  17.  
  18. </html>
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  

Post Information

  • Total Posts in this topic: 11 posts
  • Users browsing this forum: No registered users and 58 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.