473,568 Members | 2,939 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript access denied between jsp applications

Newsgroups: comp.lang.javas cript
Subject: access denied when trying to pass data between jsps
Date: Thu, 09 Mar 2006 10:42:01 -0800

I have two jsp applications. One written with struts and one without.
My struts based application uses window.open to open the first page of
my non-struts application, the user goes through a number of screens
and I then need to copy info from my non struts ap to fields of a form
on my struts ap.

When I was using http://localhost:portnumber/ap/page.jsp
to open http://localhost:portnumber/otherap/page.jsp

and using window.opener.d ocument.forms[0][fieldname] = x
I had no problems.

However when I try to access it from another machine with:
http://computername:portnumber/ap/page.jsp
The page opens but the window.opener.d ocument.forms[0][fieldname] = x
gives a javascript error which says 'access is denied'

Any help would be greatly appreciated

Mar 9 '06 #1
3 5711
Pr***********@g mail.com wrote:
However when I try to access it from another machine with:
http://computername:portnumber/ap/page.jsp
The page opens but the window.opener.d ocument.forms[0][fieldname] = x
gives a javascript error which says 'access is denied'


<URL:http://jibbering.com/faq/#FAQ4_19>
--
Now with alcohol <URL:http://youtube.com/watch?v=lnQTZxq xc10> =X
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Mar 9 '06 #2
Thanks for that,

Both of my aps run on the same computer - and they are both running on
the same web server. Is there a way I can set the document.domain
attribute to allow the interaction between my pages?

Mar 9 '06 #3
Pr***********@g mail.com wrote:
Newsgroups: comp.lang.javas cript
Subject: access denied when trying to pass data between jsps
Date: Thu, 09 Mar 2006 10:42:01 -0800
Do not reproduce headers.
[...]
When I was using http://localhost:portnumber/ap/page.jsp
to open http://localhost:portnumber/otherap/page.jsp

and using window.opener.d ocument.forms[0][fieldname] = x
I had no problems.

However when I try to access it from another machine with:
http://computername:portnumber/ap/page.jsp
The page opens but the window.opener.d ocument.forms[0][fieldname] = x
gives a javascript error which says 'access is denied'


Because what happens is that http://computername:portnumber/ap/page.jsp
tries to access http://localhost:portnumber/otherap/page.jsp which is not
allowed as the domains are different (computername != localhost). If you
search the archives for "Same Origin Policy", you will see that not even
document.domain helps you here, as either you do not provide a FQDN for
"computerna me" (you should always post real addresses if you can), hence
there is no explicit second-level domain, or the second-level domains are
different (your.domain.ex ample != localhost.local domain).

If you use relative URIs instead, there should not be any problem.
Because, for example, /otherap/page.jsp refers to
http://computername:portnumber/otherap/page.jsp if accessed from
http://computername:portnumber/ap/page.jsp. See RFC3986.
HTH

PointedEars
Mar 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2090
by: Rob Fentress | last post by:
I am trying to develop very standards-compliant content using XHTML and CSS. I am using CSS positioning and thus need to only include my stylesheet on browsers I have tested to make sure they display correctly. The page is readable without the CSS though the formatting is not pretty, but browsers like Netscape 4.x bungle the positioning if...
0
7916
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7660
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6275
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2101
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.