Web Analytics Made Easy -
StatCounter popup questions - CodingForum

Announcement

Collapse
No announcement yet.

popup questions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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
    I try to convince 'em that I am computer geek, but I just can't do it. Why? Oh why?

    Comment


    • #3
      function popup(thePage){
      var myPopup = window.open(thePage,"popup1", etc);
      }
      I forgot to say that you should put var
      I try to convince 'em that I am computer geek, but I just can't do it. Why? Oh why?

      Comment


      • #4
        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)

        Comment


        • #5
          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.
          I try to convince 'em that I am computer geek, but I just can't do it. Why? Oh why?

          Comment


          • #6
            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; Jun 19, 2002, 10:58 AM.

            Comment


            • #7
              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.
              I try to convince 'em that I am computer geek, but I just can't do it. Why? Oh why?

              Comment


              • #8
                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 - CodingForum 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)

                Comment

                Working...
                X