cancel
Showing results for 
Search instead for 
Did you mean: 

window.createPopup - Access denied

Faaiez
Advisor
Advisor
0 Kudos

Hi Everyone

When creating an object using the following Javascript:

    var oPopup = window.createPopup();

I try to set the innerHTML of this object using the following Javascript:

    oPopup.document.body.innerHTML = oHistory.innerHTML;

But get an Access denied error when doing this. I know this is because the domain has been relaxed on the main BSP page but does anyone know how I can relax the domain on this new window before creating it?

I am trying to replicate the popup glossary example from the MSDN website:

<a href="http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/createpopup.asp"> Popup Glossary Definitions

</a>

TIA

Faaiez

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

I know why this happens.

As a workaround, do not specify any BaseURL or Domain in your document. You will find your code works after removing those.

I believe future IE7 will fix this.

former_member181879
Active Contributor
0 Kudos

If you control the complete application, consider to just remove all the domain relax stuff. Usually this comes from the portal integration flag.

Alternative, you must have a relaxed popup window (and programmer?) before starting to mess with this contents. The trick that we use is to load a relaxDomain.htm document into such a new window. Thereafter, it is relaxed, and we can pump in new HTML code.

Look at rendered HTMLB source to get the correct URL you want. Or see SYSTEM, frame buffered examples.

Is this enough to put you on the road again?

Faaiez
Advisor
Advisor
0 Kudos

For completeness:

I have managed to use a javascript PopupWindow.js to achieve this task. The javascript was downloaded from http://www.mattkruse.com/.

Faaiez

dhorions
Contributor
0 Kudos

I don't think it is a good idea to use this createPopup function, because it is ie5.5+ only.

Another way to do what you want is this :


<html>
<head>
<script type="text/javascript">

function popup(text)
{
	var w =  window.open ("about:blank",
	"forum","menubar=1,resizable=1,width=675,height=650,scrollbars=yes"); 
	w.document.write( text);
	w.focus();
	
}
</script>
</head>
<body>
<a href="javascript:popup('this is a test');">Test</a>
</body>
</html>

Faaiez
Advisor
Advisor
0 Kudos

The BSP will only be rolled out inhouse and all the users use IE6.0 so this is not a problem.

I know that one can open a different popup with window.open and window.showModalDialog. Both of these I have used successfully but I would like to develop a page that has the same effect as the 'Popup Glossary Definitions' example on the MSDN website.

dhorions
Contributor
0 Kudos

I didn't really understand what the popup object was.

I thought it was a window, but actually it looks like you could mimic this functionality by showing and hiding a div.

Message was edited by: Dries Horions

Former Member
0 Kudos

Dries is correct. IE's popup is a popup window.