View Full Version : popup questions

06-18-2002, 12:33 AM
I made link wich opens popup window named "popup1" on this way:
and I need script wich I will put in first.html, something like :
if (window name is not "popup1")

How to prevent loading of pages different than first.htm
in popup window named "popup1" ?

I this possible? :confused:

Best Regards

*I need this only for IE

06-18-2002, 01:06 AM
i think if you do it this way it might help.

function popup(thePage){
myPopup = window.open(thePage,"popup1", etc);

then in the link

<a href="#" onClick="popup('first.htm')">click here to go to the first page</a>

<a href="#" onClick="popup('theother.htm')">click here to go to the other page </a>

I hope this helps

06-18-2002, 04:08 PM
function popup(thePage){
var myPopup = window.open(thePage,"popup1", etc);
I forgot to say that you should put var

06-18-2002, 06:57 PM
Thanx MikoLone ! :)

Sorry for confusion.

Well, OK I resolve 1. problem
(preventing of lading first.html in window that is not named "popup1")
using this:
if (!opener)

But second problem is more difficoult.
How to prevent other pages to load in my popup window named "popup1" ?

I suppose that it is not possible with javascript ?
How to put information in popup window that loads only specified page?

Why I need this ?
Well I have FULLSCREEN site and if somebody
open page in new window from other site or
open saved page form hard disk it will be loaded
which I had put in the page will be lost,
and for begginer it is trouble.
How to avoid other pages to loads in my popup window (FULLSCREEN) ?

thanx for advice in advance


(sorry for english)

06-18-2002, 10:24 PM
You might try using a function like the one that I wrote earlier becuase it might solve the problem that you are having. I tried it out and when I pop a window up with a function it never is over written. I am not sure why it does that but it doesn't matter what I open my window always stays open. :thumbsup: Good luck finding an answer to your problem. I hope you can figure it out.

06-19-2002, 03:47 PM
Sorry for mistake,

page is not rewriten when new window is opened from other site,
but when I open some html page from my pc then it rewrite last opened window page,
and in case that my fullscreen window is last opened then it will rewrite it and
then CLOSE BUTTON which I had put in the page will be lost, and for begginer it is trouble.

It hapends and with your sugestion MikoLone, open your popup and then open new page from you hard drive. Popup page will be rewrited.

top.frame with CLOSE button in it, is not solution, page opened from pc overwrites all.

Anyway thanks for advices ;)

06-19-2002, 04:33 PM
WoW, i don't know. I haven't ever tried to had to deal with that problem. I am not sure how to fix it. I am sure someone else knows. When you figure it out, you should post the solution. Good luck.

06-24-2002, 08:12 PM
Well, I find some kind of solution ... when you try to open page from the hard drive into last opened window - in this case fullscreen - fullscreen window closes.

Problem is with REFRESHING and this is my idea ...

I made REFRESH button in main page (I'm using fullscreen window with iFrame in it)
with wich user will be able to refreshs only iFrame page.

But when user wants to refresh whole page with RIGHT CLICK -> REFRESH
I use this:

function click(e) {
if (event.button==2||event.button==3) {
rdc = 1;
return true;

*** Then, Ctrl+R and F5 script (thanks to JKD - CodingForums Moderator)
document.onkeydown = document.onkeypress = document.onkeyup = function(evt) {
var event = evt || window.event;
if ((event.keyCode==116) || (String.fromCharCode(event.keyCode).toLowerCase() == 'r' && event.ctrlKey)) {
rdc = 1;

function ops(){
alert('SAFE SURFING ALERT\nCan not load new TOP page in fullscreen window. \nSorry, page will be closed now.');

<body onUnload="if (rdc == 0) ops();" onLoad="rdc = 0;">

*** Also, CLOSE button neds to have variable:
onClick="rdc = 1, top.window.close();"

I'm javascript begginer and need opinion from experts about this.

Best Regards
(Sorry for english)