Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > javascript access denied between jsp applications

Reply
Thread Tools

javascript access denied between jsp applications

 
 
PromoteDirect@gmail.com
Guest
Posts: n/a
 
      03-09-2006
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://localhostortnumber/ap/page.jsp
to open http://localhostortnumber/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://computernameortnumber/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

 
Reply With Quote
 
 
 
 
Jonas Raoni
Guest
Posts: n/a
 
      03-09-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> However when I try to access it from another machine with:
> http://computernameortnumber/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
 
Reply With Quote
 
 
 
 
PromoteDirect@gmail.com
Guest
Posts: n/a
 
      03-09-2006
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?

 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      03-11-2006
(E-Mail Removed) 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://localhostortnumber/ap/page.jsp
> to open http://localhostortnumber/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://computernameortnumber/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://computernameortnumber/ap/page.jsp
tries to access http://localhostortnumber/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://computernameortnumber/otherap/page.jsp if accessed from
http://computernameortnumber/ap/page.jsp. See RFC3986.


HTH

PointedEars
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access denied in javascript when try to see contents of page in javascript opened window admyc Javascript 2 09-04-2007 12:29 AM
Very annoying error: Access to the path is denied. ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity Jay ASP .Net 2 08-20-2007 07:38 PM
[JSP] difference between jsp:forward and jsp:include alexjaquet@gmail.com Java 0 06-02-2006 01:21 PM
403 Forbidden: You were denied access because: Access denied by access control list Southern Kiwi NZ Computing 6 03-19-2006 05:19 AM
Difference between Python CGI applications and Php applications praba kar Python 2 05-04-2005 06:49 PM



Advertisments