/    Sign up×
Community /Pin to ProfileBookmark

Setting location of a frame from another frame from different domain.

[COLOR=Blue]I have two frames showing jsps from two different domains(both of them are from my web application only).

I would like to change the left navigation (basically a javascript tree) dynamically on some actions happening on the right side frame (content) e.g. reloading the navigation frame page.

I tried following:
parent.parent.nav.location.reload(true);
window.nav.location.href=window.nav.location.href (i thought it will refresh the page)
– It didnt work in Firefox (it denies to know something called as nav in second case)
– In Internet Explorer, I got an javascript error message of “Permission Denied”.

Is it possible what I am trying to do. Please help. [/COLOR]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@rigadonAug 09.2005 — The error you see in IE is because JavaScript does not allow you to touch any bit of a document on a different domain, for security reasons.

I've had to do something a bit like this before. I had to populate a form in the parent window from a popup, where the parent and popup were on different domains.

The solution I used was to create a page on the parent domain to do my population through JavaScript. Thus once I had the information in the popup I would pass the data to the new page (still in the popup window) which would populate the form and close the popup window.

You could do something similar, if you can be bothered - it's a bit long-winded ?
Copy linkTweet thisAlerts:
@bvbhavsarauthorAug 11.2005 — [COLOR=Blue]Thanks rigadon for the hint ?



I found a way to do it.

Here is it:

I created a hidden frame on the same domain as navigation frame. So basically this hidden frame has permission to refresh the navigation frame.

The frame has a meta-refresh set so it contacts the navigation application after a fixed interval. Its refreshes the navigation frame only after a specific attribute in the application context has changed.



The content frame application which is on a different domain contacts the navigation application (using a HTTP post) and notifies of addition of node by changing the context attribute in the navigation application.



Once the context attibute is changed, the hidden frame app gets to know the changes on the next attempt of contacting the server. It refreshes the navigation frame.



I am using the javascript tree from [URL=http://www.mattkruse.com/scripts/tree/index.html]http://www.mattkruse.com/[/URL]

It maintains the state of the tree using cookies. I liked it ?[/COLOR]
×

Success!

Help @bvbhavsar spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...