473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

javascript access denied between jsp applications

Newsgroups: comp.lang.javascript
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.document.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.document.forms[0][fieldname] = x
gives a javascript error which says 'access is denied'

Any help would be greatly appreciated

Mar 9 '06 #1
3 5695
Pr***********@gmail.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.document.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=lnQTZxqxc10> =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***********@gmail.com wrote:
Newsgroups: comp.lang.javascript
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.document.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.document.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
"computername" (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.example != localhost.localdomain).

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
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.