12

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

2
  • Do you have any control over these pages that are being displayed inside the frames? Jul 25, 2010 at 20:38
  • 1
    No, I don't, I need the visitors to view them, but not allow the page to set or view cookies.
    – DLiKS
    Jul 25, 2010 at 21:13

3 Answers 3

11

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

2
  • Thanks, will this attribute work in other browsers using the chrome frame?
    – DLiKS
    Jul 26, 2010 at 0:51
  • chrome has this since version 5, so it is probably in chrome frame also, other browsers will probably implement this soon
    – Arjan
    Jul 26, 2010 at 9:02
1

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.

0

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.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.