/    Sign up×
Community /Pin to ProfileBookmark

Opening link in correct frame?

Hi all
A couple of questions which I can imagine have been covered before, but I for which I cant seem to find clear answer for.

The code below seems fairly standard and is posted all over the net.
It checks to see if a page is in a framed enviroment when opening and if not is redirected to open the parent url.

Im trying without success for it to go one step further – If page detects it is not in framed environment open parent framed url AND open in the correct frame!

<SCRIPT LANGUAGE=”JavaScript”>
<!– Hide script from older browsers
function changePage() {
if (self.parent.frames.length == 0) self.parent.location=”main frameset url”;
}
changePage();
// end hiding contents –>
</SCRIPT>

Any simple cross browser solutions?

Also as you may have guessed I’m not that familiar with Javascript and being an old fashioned programmer I like to have a comprehensive resource of a languages syntax/functions/methods etc etc. to work with.
Self.parent.frames.length or height or width or who knows ….. ….. where does all this come from, where can I see, in one resource, ALL the language, in a clear, concise way. Any help on this would be great!

Thanks
Adaman

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceFeb 15.2006 — There is no method for verifying that you are loaded in the correct frame because if you are loaded in someone else's frame then your JavaScript code is not allowed access to it (cross-domain scripting).
×

Success!

Help @AdaMan 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.14,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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