on 2004 Oct 08 2:21 PM
Hi everybody,
I've programmed a Javascript popup (window.open ... window.document.write).
This does not work in the EP running on Internet Explorer 6.0 SP 1 (no problems in my PDK).
In the EP this script only open the new window, but without contents.
all help would be appreciated ,
Thanks in advance,
David Reifs
Hi David,
do you get ana JavaScript errors returned from IE?
Please post the relevant source code here so we can all see your approach.
Thanks,
Dominik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
I see. This access denied is probably causes by your "write" statements. The JavaScript tries to write somewhere where it shouldn't do so (e.g. in a frame outside of its own, a window it did not open itself etc). This access denial is by design and prevents some cross site scripting attempts.
Please provide the essential source codes so we can check what access is actually denied, why it is and how you can resolve this issue.
Regards,
Dominik
Hi all,
I have the exact same problem. Here is my JavaScript Code:
<script language="javascript">
function showResults() {
win1 = window.open();
win1.document.write('test');
}
showResults();
</script>
This works flawlessly when run standalone, but does not work in EP.
Any help on this is highly appreciated.
Kind regards,
Francisco
Relaxing the domain in the popup allows the main and popup windows to 'talk' to each other, but the code shown in a previous post (win1.document.write('test')) cannot be used to relax the domain since the main window cannot write to the popup until it's domain has been relaxed.
One solution (based on the Portal's Date Picker popup) is to:
1. Set a Javascript variable in the main window to the desired HTML
2. Open the popup with the URL of a HTML page that relaxes the domain then writes the HTML from the variable in the main window.
For example:
1. Create a static HTML page called 'empty.html' to be displayed in the popup:
<html>
<head>
<script language="JavaScript">
if (window.document.domain == window.location.hostname) {
if (document.domain.indexOf('.') != -1) {
document.domain = document.domain.substring(document.domain.indexOf('.')+1);
}
}
document.write(window.opener.myHtml);
this.focus();
</script>
</head>
<body>
</body>
</html>
2. Use code like the following to create a URL to this static HTML page:
IResource htm = request.getResource(IResource.STATIC_PAGE, "htm/empty.htm");
String emptyUrl = htm.getResourceInformation().getURL(request);
3. Use code like the following Javascript to open the popup, and set the HTML to be displayed in the popup:
var myHtml = "";
function openPopup(title, emptyUrl, theHtml, windowName) {
myHtml = theHtml;
var atts = 'top=0,left=0,height=200,width=200,resizable=yes,menubar=yes,scrollbars=yes,status=yes';
var myApp = window.open(emptyUrl, windowName, atts);
if (myApp) {
myApp.focus();
}
else {
alert('You may have unrequested popup blocking on.');
}
}
4. Then use code like the following to create the button that displays the popup:
<span id='myPopupButton' class='sapBtnStd' title='Click to open popup'
onClick="openPopup(
'My Pop Title',
'<%= emptyUrl %>',
'<h1>Hello World</h1><b>It's great to be alive.</b>',
'MyPopUp')">
Open My Popup
</span>
A bit complicated when all you want is a pop up - but it works.
Hi people,
have not tested it, but I deem that opening the window with an already relaxed domain could work either, something like this:
<script>
var popup = window.open("http://"window.document.domain"/","MyTitle");
popup.document.write("<h1>Hello</h1>");
</script>
Somebody has the time to test this?
Hi
This particular thing wont work. The domain is normally the webserver that the HTML page exists on and is called from. The relaxing of the domain is specific to the document object AFTER it has been opened. Therefore when accessing a HTML on a webserver the domain, by default, has the value of the webserver on which it resides.
EP relaxes this domain automatically.
However, what might help is something like this
<script language="JavaScript">
var mywindow = window.open("http://portal.mywebserver.com");
mywindow.domain = <code for relaxing the domain>
mywindow.write("<html code>");
</script>
Where the <code for relaxing the domain> is mentioned in my previous thread and the link is in one of these replied.
I hope this helps a little. as I said I haven't tested this just yet, but it may work.
Darrell
User | Count |
---|---|
70 | |
10 | |
10 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.