[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Ridding of double name in window.open

Posted on 2004-11-25
23
Medium Priority
?
5,472 Views
Last Modified: 2013-11-19
The script works fine for me (almost, see my other thread). However when it launches the new window it gets "http://www.mypage.com" infront of the window title that I have given it. I want my title to appear in a specific way and I'm picky. If I delete the text in the title tag the script doesn't work either, but I don't want to do that anyway (babbling, sorry).

My whole source is:

<<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<head>
     <title>&#58;&#58;&#32;&#32;andreasgustavsson.com&#32;&#32;&#58;&#58;</title>
     
     <script type='text/javascript'>
function SetWindow()
{
     url = "mainplayer.htm"              //Set address of new window
  var height = 600                       //Set height
  var width = 800                        //Set width
  var name = ""                          //Set window name
  var top = 200                          //Set distance from top
  var left = 200                         //Set distance from left
  newwin=window.open(url, name, "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no,width=" + width + ",height=" + height + ",left=" + left + ",top=" + top);
       // Cannot perform across all browsers
        //this.focus();
        //self.opener = this;
        //self.close();
     
}
</script>

</head>

<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" bgcolor="#000000">

<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
<tr>
       <td align="center" valign="middle"> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#3,0,0,0" width="550" height="400">
    <param name="src" value="flash/intro.swf">
      <param name="quality" value="high"
    <embed src="flash/intro.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/" type="application/x-shockwave-flash" width="550" height="400">
    </embed>
  </object></td>
</tr>
</table>


</body>

See http://www.andreasgustavsson.com/beta to see what I mean.

Cheers

/A
0
Comment
Question by:iamcmag
  • 9
  • 4
  • 3
  • +5
23 Comments
 
LVL 25

Expert Comment

by:archrajan
ID: 12677539
try this
<title style = "align:center">::andreasgustavsson.com::</title>
0
 
LVL 25

Expert Comment

by:archrajan
ID: 12677551
if thats not what u want.. could you please explain a little more on what u r looking for?
0
 
LVL 25

Assisted Solution

by:archrajan
archrajan earned 664 total points
ID: 12677583
see this
STEP 1.
Inserting the <script> in your page

Put the following <script> </script> in the head
section of your launching page.  

Set the variables as indicated in the script.

<script>

// Amazing Frameless Popup Window - Version I
// (C) 2000 www.CodeLifter.com
// Free for all users, but leave in this  header

// set the popup window width and height

var windowW=214 // wide
var windowH=398 // high

// set the screen position where the popup should appear

var windowX = 260 // from left
var windowY = 100 // from top

// set the url of the page to show in the popup

var urlPop = "yourpage.html"

// set the title of the page

var title =  "This Is A Frameless Popup Window"

// set this to true if the popup should close
// upon leaving the launching page; else, false

var autoclose = true

// ============================
// do not edit below this line
// ============================

s = "width="+windowW+",height="+windowH;
var beIE = document.all?true:false

function openFrameless(){
  if (beIE){
    NFW = window.open("","popFrameless","fullscreen,"+s)    
    NFW.blur()
    window.focus()      
    NFW.resizeTo(windowW,windowH)
    NFW.moveTo(windowX,windowY)
    var frameString=""+
"<html>"+
"<head>"+
"<title>"+title+"</title>"+
"</head>"+
"<frameset rows='*,0' framespacing=0 border=0 frameborder=0>"+
"<frame name='top' src='"+urlPop+"' scrolling=auto>"+
"<frame name='bottom' src='about:blank' scrolling='no'>"+
"</frameset>"+
"</html>"
    NFW.document.open();
    NFW.document.write(frameString)
    NFW.document.close()
  } else {
    NFW=window.open(urlPop,"popFrameless","scrollbars,"+s)
    NFW.blur()
    window.focus()
    NFW.resizeTo(windowW,windowH)
    NFW.moveTo(windowX,windowY)
  }  
  NFW.focus()  
  if (autoclose){
    window.onunload = function(){NFW.close()}
  }
}

</script>

==============================================================

STEP 2.
Triggering the popup window

Call the openFrameless function from a link, like this:

<a href="javascript:openFrameless()">click here</a>

==============================================================

STEP 3.
Conditioning the page that goes in the popup window

Add the following call to the <body> tag of the page that
will open in the popup *if* your popup does not come to the
front after it loads.  This is occasionally needed in early
versions of IE4, and with certain types of page content that
manipulate focus. If in doubt, put it in -- it can't hurt.

<body onload="top.window.focus()">

==============================================================

ADDENDUM 2/22/2001
Making the Frameless Popup Center on the Screen Automatically

We've had numerous requests for this, and a minor modification
of the script can do it.  Here's how...

Comment out the two lines as shown, and add the two shown below
them.

// set the screen position where the popup should appear

//var windowX = 260 // from left
//var windowY = 100 // from top
var windowX = (screen.width/2)-(windowW/2);
var windowY = (screen.height/2)-(windowH/2);

==============================================================
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 25

Expert Comment

by:devic
ID: 12677876
try window.title

e.g.:
newwin=window.open(url, name......
newwin.title="&#58;&#58;&#32;&#32;andreasgustavsson.com&#32;&#32;&#58;&#58;"
0
 
LVL 31

Expert Comment

by:GwynforWeb
ID: 12678302
<script>
  win=window.open('','','height=300,width=700')
  win.document.title="::andreasgustavsson.com::"
</script>
0
 

Author Comment

by:iamcmag
ID: 12680316
I will get back to you gyus with trying your ideas and giving you the points as soon as I can. I'm just a bit pre-occupied at the moment, things got in my way.
I'm really glad to see that many good advice though.

Thanks for now.
0
 

Author Comment

by:iamcmag
ID: 12766497
Okay I'm back sorry for the long delay.
I've tried all of the above examples, they are all good suggestions. However they all have the same problem, I'm getting the url in front of the name on the titlebar. After trying around I can't get my original script to care for the name var at all, it just adds the url and then reads the title from head/title tag. I thought that it was solved when I tried GwynforWebs suggestion, it looked fine locally but as soon as you add the url of the page to load it has the same problem. There must be a way around this.

Again check my web site to see the problem.
http://www.andreasgustavsson.com/beta

I must also say thank you to archrajan for the well explained script, unfortunately it rendered the same problem.

Grateful for more suggestions.
0
 

Author Comment

by:iamcmag
ID: 12766706
To GwynforWeb or someone else:

What does the second parameter specify, isn't that the name? If I put something there in qoutation marks it igonres it, but if try to give it a var the window doesn't open.

This works (but renders the old problem):
var path="mainplayer.htm"

win=window.open(path,'','height=600,width=800');

This works (but ignores the string and renders the old problem):
var path="mainplayer.htm"

win=window.open(path,"Test",'height=600,width=800');

This doesn't work:
var path="mainplayer.htm"
var name="test variable"

win=window.open(path,name,'height=600,width=800');
0
 
LVL 3

Accepted Solution

by:
yourbudweiser earned 668 total points
ID: 12767478
Try this:

PAGE1.HTM
--------------
<script language="javascript">
/* Open window*/
 var windowHandle = '';
 function openSesame(url,name,attributes) {
 windowHandle = window.open("page2.htm?"+escape(url),name,attributes);
}
</script>

<a href="javascript:openSesame('faq.htm','Search','toolbar=no,resizable=yes,scrollbars=yes,width=200,height=200');">Open Sesame</a>


PAGE2.HTM
--------------
<head>
<title>Put Your Title Here</title>
</head>
<script>
document.write('<frameset rows="100%,*"><frame src="'+unescape(location.search.substring(1))+'"></frameset>')
</script>
</html>

Good luck!
YBW
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 12767932
      
var windowHandle = '';
var height=600;
var width=800;
//var left=200;
//var top=200;
var windowX = (screen.width/2)-(windowW/2);
var windowY = (screen.height/2)-(windowH/2);

      
should have

var windowH=600;
var windowW=800;
defined

And I get
main
in front of the browser window that pops in both mozilla and IE6 on XP
0
 

Author Comment

by:iamcmag
ID: 12768997
I'm dead for the night and will take breather 'til tomorrow, I'm glad to see some new stuff I can wake up and try.

Cheers.
0
 

Author Comment

by:iamcmag
ID: 12785035
Back again.

Thanks for the correction mplungjan, it's sorted.
I tried your script yourbudweiser, but to me it makes no difference. The silly url is still there. This is starting to freak me out, it must possible to get rid of it. I seem to be running out of ideas though. Do you guys get the same results when running the same type of script elsewhere or could it be server sided? It doesn't appear if you run it locally.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 12785737
Please show a url and explain exactly what to look for where

Michel
0
 

Author Comment

by:iamcmag
ID: 12786035
http://www.andreasgustavsson.com/beta

I can't get rid of the url in front of my page title. That's really all that I want. Where it says "http://www.andreasgustavsson.com - :: andreasgustavsson.com" I want to rid the "http://www.andreasgustavsson.com -"

Thanks.
/Andreas
0
 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 668 total points
ID: 12786714
Dunno where it says that.

I have :: andreasgustavsson.com :: in the titlebar of  IE6, mozilla and netscape 4.7 on windows xp

Michel
0
 
LVL 3

Expert Comment

by:yourbudweiser
ID: 12786741
I don't see it either. Looks fine to me.

YBW
0
 

Author Comment

by:iamcmag
ID: 12786793
That's so wierd. I'm running IE6 myself, but then again I don't trust any of my computers one tiny bit. Maybe this is an excuse to get a new one *smiles*.

I will check it out and get back about the points.

Thanks alot guys.

/A
0
 
LVL 3

Expert Comment

by:yourbudweiser
ID: 12787607
I have to give thanks to Michel. He originally helped me out when I had a similar problem.

Thanks for the points.

YBW
0
 

Author Comment

by:iamcmag
ID: 12787630
Since this thread ran for a long a time and I received good help from several people I have split the points in what I hope was a just manner. Thanks to everobody that got involved.

As a last question I would just like to ask if anyone has a clue as to what this problem could be since i run IE6 and XP myself. I've tried restoring security settings and pop-up blocker in IE which didn't change anything.

/A
0
 

Expert Comment

by:MikeAllred
ID: 13093495
I had this exact same problem and just resolved it, although I'm not too thrilled with the answer - here it is
If you use window.open with no window features specified you get the title just the way you set it with no server name.  As soon as you add 'window features' you lose all the defaults. I went through the defaults one at a time until I found the culprit - location=1
Therefore to get the title to show the way you want it you also have to have the location bar showing

eg.
//this will show server name in title
var path="mainplayer.htm"
win=window.open(path,'','height=600,width=800');

//this shows only the title
var path="mainplayer.htm"
win=window.open(path,'','height=600,width=800,location=1');

//this also shows only the title
var path="mainplayer.htm"
win=window.open(path,'','');


0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 13094315
??? How come I had no problems then ?

Also location=1 can be written location
I have never experienced these problems anywhere.

Michel
0
 

Author Comment

by:iamcmag
ID: 13134795
Yeah I don't know, this is just a really strange problem. After I found out that it didn't seem to be showing everywhere I asked some different people to try the page. And I concluded that it was not just my machines that caused it. On some computers it shows and on some it doesn't. I really can't tell why since most even run the same IE version.

Thanks again everyone.

/A
0
 
LVL 1

Expert Comment

by:aprasadh
ID: 13546254
I will tell you one thing. This is a bug in IE 6 for Win XP service pack 2.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
This article discusses how to create an extensible mechanism for linked drop downs.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question