Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: popup questions

  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    EUROPE
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question popup questions

    1. PROBLEM
    I made link wich opens popup window named "popup1" on this way:
    href="javascript:window.open('first.html','popup1','menubar=yes')"
    and I need script wich I will put in first.html, something like :
    if (window name is not "popup1")
    window.location.replace("otherpage.html");

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

    I this possible?

    Best Regards

    *I need this only for IE

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Provo, UT
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Provo, UT
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    function popup(thePage){
    var myPopup = window.open(thePage,"popup1", etc);
    }
    I forgot to say that you should put var

  • #4
    New Coder
    Join Date
    Jun 2002
    Location
    EUROPE
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    in my FULLSCREEN and then CLOSE BUTTON
    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

    Regards

    (sorry for english)

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    Provo, UT
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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. Good luck finding an answer to your problem. I hope you can figure it out.

  • #6
    New Coder
    Join Date
    Jun 2002
    Location
    EUROPE
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Last edited by Alias; 06-19-2002 at 03:58 PM.

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Location
    Provo, UT
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #8
    New Coder
    Join Date
    Jun 2002
    Location
    EUROPE
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    onClick="external.window.location.reload()"

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

    <script>
    function click(e) {
    if (event.button==2||event.button==3) {
    rdc = 1;
    return true;
    }
    }
    document.onmousedown=click;
    </script>


    *** Then, Ctrl+R and F5 script (thanks to JKD - CodingForums Moderator)
    <script>
    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;
    }
    }
    </script>


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

    <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)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •