Getting permission denied error

0 views
Skip to first unread message

krishna chaitanya

unread,
Jun 23, 2008, 9:24:23 AM6/23/08
to Orkut Developer Forum
Hi

Issue:
====
Not able to execute a javascript method from serverside code.


window.parent.executeMethod()


or


top.executeMethod()


in the server side code is returning permission denied error. (Was
able to find the error message using firefox webdevloper extension.
Otherwise page displayes blank html)


Requirement
==========
In orkut application I can fetch all the friends of the owner.
Now my server will randomly decide a friend. I want to display
that random friend image in the page.

[Please refer to
http://developer.apple.com/internet/webcontent/iframe.html
for remote scripting strategy.]


I am calling the serverside php in an iframe. So I won't have access
to the iframe innerHTML.

This is why I am trying to call a method in client javascript code
from the server side. This is giving permission denied error.


Any workarounds for this issue.


Jason

unread,
Jun 24, 2008, 2:35:18 PM6/24/08
to Orkut Developer Forum
It sounds like you're running into a cross-domain issue. Because the
page loaded in your IFrame is hosted on a different domain than the
containing page, the browser won't let you call certain methods or set
certain properties on the containing window -- you'll get a
"Permission denied" error instead.

In general, building a client-side OpenSocial application in this way
is a losing strategy -- even if you can get owner and friend
information into the IFrame at load time, your application won't be
able to post activities in response to a user action or otherwise
interface with the OpenSocial API, defeating the purpose of building a
social application in the first place. I suggest waiting for the REST-
based API (which is coming with support for OpenSocial 0.8) or
implementing your server-side business logic in JavaScript (e.g.
random friend selection) -- your server can still come in handy if you
need to store information in or retrieve information from your
database, which you can do a call to the client-side
gadgets.io.makeRequest method.

Let me know if you have any other questions.

- Jason

On Jun 23, 6:24 am, krishna chaitanya <krishnachaitanya...@gmail.com>
wrote:
> Hi
>
> Issue:
> ====
> Not able to execute a javascript method from serverside code.
>
> window.parent.executeMethod()
>
> or
>
> top.executeMethod()
>
> in the server side code is returning permission denied error. (Was
> able to find the error message using firefox webdevloper extension.
> Otherwise page displayes blank html)
>
> Requirement
> ==========
> In  orkut application I can fetch all the friends of the owner.
> Now my server will randomly decide a friend.  I want to display
> that random friend image in the page.
>
> [Please refer tohttp://developer.apple.com/internet/webcontent/iframe.html
Reply all
Reply to author
Forward
0 new messages