views:

38

answers:

3

Hi!

Is there any way to programatically disable cookies being created by a page displayed inside of a frame/iframe? Or to generalise further, is it possible to programatically disable javascript running on such a page?

Thanks,

DLiKS

A: 

If you mean that you want to change the settings of the browser by code in a web page, then no, this is not possible (and if it were possible, it's a huge security breach and all alarms would go off).

You may surpass this, however, by writing a plugin, but then each user must first download the plugin. You can also request higher priviledges, but it'll depend on the browser whether you can change any user settings.

If you mean that you want to write a script on every pc in your company to disable JS + cookies for certain pages, you can write plugins and install them everywhere, or use a proxy (as has been suggested by others) and filter the pages. If it is just for debugging a self-made page, use the Developer Toolbar for the various browsers, that can turn JS/Cookies on and off.

Why would you want to do such a thing? If you want to disable cookies, you disable it on your own page by simply not using cookies. The same goes for javascript: don't add it to your page and you've disabled it on your page.

Note: if any page would change anything of the user settings of the browser, your page will probably be blacklisted by Google, most virus scanners and fishing prevention tools.

Abel
A: 

The only way you could change that for an external website you have no control over is to retrieve the pages using a server-side script, filter the input and display it to the user (ie: act as a proxy).

You just can't modify sites out of your domain (or subdomain - it might depend on the browser) using J/S for security reasons.

NullUserException
+1  A: 

with iframe sandbox attribute (html5) it will be possible (implemented in chrome)

http://dev.w3.org/html5/spec/Overview.html#attr-iframe-sandbox

NullUserException already answered what you can do today without browser support

arjan
Thanks, will this attribute work in other browsers using the chrome frame?
DLiKS
chrome has this since version 5, so it is probably in chrome frame also, other browsers will probably implement this soon
arjan