/    Sign up×
Community /Pin to ProfileBookmark

How to prevent the scripts in an iframe accessing to the main window.

I want to create an iframe in which the scripts can’t access to the parent window.

However the parent window should be able to access to the sub-iframe.

Is it possible?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@FangApr 22.2008 — ? You control the JavaScript functions
Copy linkTweet thisAlerts:
@Mega69authorApr 23.2008 — I want to eval a string coming from the server.

In order not to have to test the string with a regex ( for security ) I would like to evaluate the code in a "indipependent environment" in which it is impossible, for example, to steal cookies from the parent window.
Copy linkTweet thisAlerts:
@A1ien51Apr 23.2008 — You are not going to be able to do that really. If you want to check for bad code, you should run a regular expression and make sure it is a valid JSON object and not something else.

Eric
×

Success!

Help @Mega69 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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