Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window.opener.name is blank

Status
Not open for further replies.

sodakotahusker

Programmer
Mar 15, 2001
601
What am I doing wrong?

Here is my open statement

window.open (url + querystring, 'junk',screen.width,screen.height,0,0,0,1,0,1,1,0,5);

I also tried the name on the end of the parameter list. Name is always blank.

 
Try filling all the parameters with more info.

example:
Code:
window.open('','wdwServices','fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=400,height=500,left=220,top=130');

staffa
 
Nope. Same results. In your sample wdwServices would be the opener name, right?
 
No wdwServices is not the opener, it's the name of the new window.

But are you sure that the "url + querystring" is correct, because it looks like it needs some quotation.

staffa
 
url and querystring are both variable so I can't use quotations. The page opens fine - just does not have a name. the window.opener.location.href property has a value. I guess I can use that. Do I have to set a property somewhere in my calling page to give it a name?

Now the big question is: If I find that the opener is not the correct page or is nothing - how can I mess it up so the user will not get any of the contents of the page - (I guess I could redirect them to another page which chastises them for trying to hack my site).

 
If you want to give a popup window a title, then you have to give it in the <title></title> of the page that you open. The wdwServices name i wrote is a script handler name for the new window.

I don't have a idea yet on how to do the other thing...

staffa
 
If the opener page generates the popup window onclick, then no other sites is able to open the popup.

example:
Code:
<html>
	<head>
	</head>
<body>
<script>
<!--
function doServices(){
	var generator=window.open('','wdwServices','fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=400,height=500,left=220,top=130');

generator.document.writeln('<html><head><title>SLA - Services</title>');
generator.document.writeln('<script type="text/javascript">');
generator.document.writeln('function check(){');
generator.document.writeln('infoservices = document.forms[0].elements');
generator.document.writeln('inp_services = self.opener.document.form_tilfoej.inp_services');
generator.document.writeln('txt=""');
generator.document.writeln('for (i=0;i < infoservices.length; i++){');
generator.document.writeln('if (infoservices[i].checked){');
generator.document.writeln('txt += infoservices[i].value + "\\n" }');
generator.document.writeln('inp_services.value = txt');
generator.document.writeln('} self.close() }');
generator.document.writeln('</script>');
generator.document.writeln('</head><body style="font-family:verdana,arial,helvetica,sans-serif;">');
generator.document.writeln('<font size="3"><b>Choose Services</b></font><br><br><form>');
generator.document.writeln('<p><font size="2"><input type="checkbox" value="test">&nbsp;test</font></p>');
generator.document.writeln('<input type="button" value="  OK  " onclick="check(this)"></form>');
generator.document.writeln('</body></html>');
generator.document.close();
}
//-->
</script>
<form name="form_tilfoej">
<textarea name="inp_services" cols="40" rows="7"></textarea><input type="button" name="btn_services" value="Choose Services" OnClick="javascript:doServices();">
</form>

</body>
</html>

Hope you can use this exaple to something :)

staffa
 
Just some food for thought:

window.opener.name, the title of your thread, refers to the name of the original window, not the one you've just created.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top