<html> <head> <script> function setCookie() { document.cookie = 'foo=baz'; // If there is a cookie prompt showing, then reading from document.cookie // should block until the dialog is closed. if (document.cookie.indexOf('foo') == -1) { document.title = 'cookie blocked'; } else { document.title = 'cookie allowed'; } } </script> </head> <body onload="setCookie();"> </body> </html>