I am getting an Access denied error when I write to a new window. The
situation and code are outlined below. I am setting the domain in the
main window. The problem is that the window I am popping up never gets
it domain set, even though I have coded it to be the same as the main
window. I get an Access Denied errror.
Four different domains:
*localhost.mycompany.com
*test.mycompany.com
*pilot.mycompany.com
*mycompany.com
Page 1 on localhost.mycompany.com has its domain set via script:
document.domain="mycompany.com"; This is the main window
Page 2 - Written to the popup window below also is also set to the same
domain. Upon submit, Page to calls page 3 which is name lookup
servlet. Page 3 returns the value to Page 1 (main window).
<script type="text/javascript">
winstr += '<html><head><title>my App<\/title>';
winstr += '<script
type="text\/javascript">document.domain=\'mycompany.com\'<\/script>';
winstr += '<\/head>';
winstr += '<body>';
winstr += '<form name="myForm" method="get" action="default.do">';
winstr += '<div class="textbold">Last Name:<\/div>';
winstr += '<input type="text" name="searchFilter" id="searchFilter"
size="26" \/>';
winstr += '<input type="submit" value="Search" \/><\/div>';
winstr += '<\/form>';
winstr += '<\/body>';
winstr += '<\/html>';
var w=220;
var h=120;
var winname='popWindow';
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl +
',toolbar=no,status=no,menubar=no,scrollbars=no,re sizable=no';
if(win==null || win.closed)//only launch window if it doesn't already
exist
win = window.open("", winname, winprops);
win.focus();
windoc = win.document;
//win.document.domain='mycompany.com';
windoc.write(winstr);
windoc.close();
</script> 2 22626
johkar wrote: I am getting an Access denied error when I write to a new window. The situation and code are outlined below. I am setting the domain in the main window. The problem is that the window I am popping up never gets it domain set, even though I have coded it to be the same as the main window. I get an Access Denied errror.
Of course. document.domain works if the second-level domain of both
resources is the same. Since a generated document has no second-level
domain, you cannot set its document.domain. That said, I do not think
you need to.
[...] <script type="text/javascript"> winstr += '<html><head><title>my App<\/title>'; winstr += '<script type="text\/javascript">document.domain=\'mycompany.com\'<\/script>'; winstr += '<\/head>'; winstr += '<body>'; winstr += '<form name="myForm" method="get" action="default.do">'; winstr += '<div class="textbold">Last Name:<\/div>'; winstr += '<input type="text" name="searchFilter" id="searchFilter" size="26" \/>'; winstr += '<input type="submit" value="Search" \/><\/div>'; winstr += '<\/form>'; winstr += '<\/body>'; winstr += '<\/html>';
Eeek. Provided that `winstr' was declared before, consider
winstr += new Array(
'<html><head><title>my App<\/title>',
'<script type="text/javascript">',
'document.domain="mycompany.com";',
'<\/script>',
'<\/head>',
'<body>',
'<form name="myForm" action="default.do">',
'<div class="textbold">Last Name:<\/div>',
'<input name="searchFilter" id="searchFilter" size="26">',
'<input type="submit" value="Search"><\/div>',
'<\/form>',
'<\/body>',
'<\/html>'
).join("");
instead.
var w=220; var h=120; var winname='popWindow';
Unnecessary.
var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2;
Think about <URL:http://dorward.me.uk/tmp/fullscreen.jpeg>.
var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl + ',toolbar=no,status=no,menubar=no,scrollbars=no,re sizable=no'; if(win==null || win.closed)//only launch window if it doesn't already exist
if (!win || win.closed)
BTW, source code should be posted so that it can be executed as-is, also
meaning that it should not break when word-wrapped. Such (long) inline
comments should be before-comments, not after-comments.
win = window.open("", winname, winprops); win.focus();
IMO, you should wait with focusing until you have written the content.
And you should feature-test the focus() method before you call it.
windoc = win.document;
You should declare _all_ your identifiers.
//win.document.domain='mycompany.com';
See above.
windoc.write(winstr); windoc.close(); </script>
PointedEars
Thank you for the feedback. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ravi |
last post by:
I am posting this message after reading all the previous posts with
the above subject.
I have a SQL2K named instance running on a Windows 2K machine under
Local system Account and it uses SQL...
|
by: Wang, Jay |
last post by:
I try to open up a window with window.open in javascript. "domain.html"
contains domain information 'domain.school.edu'. The "Access denied" problem
happens when document.write is trying to put...
|
by: ENIZIN |
last post by:
I am having an interesting problem where I am simply trying to put in
country selection popup window on my site. When the user closes the window
the popup should call the...
|
by: David Palau |
last post by:
We have a internal company WinForms application that makes some calls
out to a intranet web service (once at application start-up for some
configuration info and then periodically during the life...
|
by: Matt |
last post by:
Just create a web service and web site.
First wsdl webservice and installed with website i am getting access
denied error.
Second tried web referance my service from website with VS and still...
|
by: Stephen |
last post by:
Hi,
What permission setting do I have to enable to allow an Excel spreadsheet to
a folder on my webserver?
I get "access denied" message when I try to write it onto a webserver
I have...
|
by: Tim Payne |
last post by:
Hi,
I have a site that works perfectly on my local machine and on a number of
other servers, that uses forms authentication for the admin area. On a new
server that I'm setting it up on, I get a...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |