View Full Version : Security in writing from one window to another

08-22-2002, 11:54 PM
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.

08-23-2002, 12:42 AM
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.

08-23-2002, 02:07 AM
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;

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)



Here is all the code for the SaveReference frame.


// 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");
var oldItem;
oldItem = OrderWindow.document.OrderForm.itemsOrdered.value;
newItem = oldItem +"\n" + newItem;
OrderWindow.document.OrderForm.itemsOrdered.value = newItem;