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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Security in writing from one window to another

    This is sort of a part two to my earlier question of referencing a newwindow = window.open() when using a window write to a new window that it opened. I solved the initial problem and it worked perfectly when I tested it on my desktop. Unfortunately I ran into a new problem when I posted the code to my isp for testing. After a little more juggling, I got it to work with Netscape 4.5. But that's all. Using IE 5 or Netscape 6, I get the following error messages:

    Netscape: Uncaught exception - permission denied to get property window.scriptglobals.

    IE: line xxxx
    char 1
    permission denied.

    I realize this has something to do with browser security. From what I've read it is supposed to effect code only when one window on a server attempts to write to or read from a window whose origin is on a different server. In my case, the cgi script and the html pages are on the same server, though in different directories.

    Is there a work-around for this situation? Are browsers newer than Netscape 4.5 using tighter security code?

    I am using a Mac running system 8.6. Any help would be most appreciated. Thank you.

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    to the best of my knowledge, there's no reason you shouldn't be able to do what you want. can we see the code you're using? that might help.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Joh6nn,

    The code is spread between two frames, one of which is dynamically generated by a Perl script. The Perl script frame produces the results of a search with a list of products that can be added to the order form in the new seperate window by clicking on the appropriate button. The actual code to write to the order form window is a function residing on the static frame, and called from the dynamic frame.

    The name of the static frame is SaveReference.
    winOpen is a variable the keeps track of the status of the order form window, whether it is open or closed.

    Here is the code on the dynamic frame used to create the order form window and call the function from the SaveReference frame to write to the order form window. I'm not sure where the error first occurs, since one of the buttons is a simple change location method, and the error message still reads permission denied, even though no line is given. It may be something else entirely that these newer browsers don't like?

    If you see anything strange please let me know.



    // If no window is present, then call this function to open
    // the new window. If the browser is Explorer then use different
    // code to move it to the top right corner.

    function orderWindow()
    {

    if (parent.SaveReference.winOpen == 1) return;

    OrderWindow = window.open(URL,Name,Features);
    if (isIE)
    {
    var newWindow;
    newWindow = OrderWindow.window.self;
    newWindow.resizeTo(400,300);
    newWindow.moveTo(700,0);
    newWindow.scrollTo(0,600);


    }
    else
    {
    OrderWindow.window.scroll(0,600);
    }
    window.focus();
    parent.SaveReference.winOpen = 1;
    parent.SaveReference.OrderWindow = OrderWindow;
    }


    // This function writes the text to the textarea in the other
    // window adding each line to the previous one.


    function AddToItemOrderForm(NewItem)
    {

    parent.SaveReference.WriteToWindow(NewItem);
    return;

    }



    Here is all the code for the SaveReference frame.



    <script>

    // Initialize variables
    var OrderWindow;
    var winOpen = 0;

    // This function writes the text to the textarea in the other
    // window adding each line to the previous one.

    function WriteToWindow(newItem)
    {

    if (winOpen == 0)
    {
    alert("You need to open the Order Form to use this feature");
    return;
    }
    var oldItem;
    oldItem = OrderWindow.document.OrderForm.itemsOrdered.value;
    newItem = oldItem +"\n" + newItem;
    OrderWindow.document.OrderForm.itemsOrdered.value = newItem;
    return;
    }

    </script>


  •  

    Posting Permissions

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