sandboxed iframe with local scoped cookies only

Viewed 120

Is it possible to load a sanboxed iframe that can run scripts and write cookies but they don't overwrite the parent's cookies?

For example outer HTML will look like this:

outer.html

  <html>
   .....
    <script>document.cookie='page=outer; path=/';</script>
    <iframe sandbox="<attribute-here>"  src="./inner.html"></iframe> 
   .....
  </html>

inner.html

  <html>
   .....
    <script>document.cookie='page=inner; path=/';</script>
   .....
  </html>

The desired result is that the outer page always remains with the cookie value outer and the inner one has the value inner

0 Answers
Related