document.cookie won't become empty whatever I do, like it does when I clean it using the browser. How would I delete all cookies in JavaScript? What I tried:  document.cookie = &quot;&quot;; but cookies behave differently. 20~ of results in a search.
24307
How do you delete all the cookies for the current domain using JavaScript?
6785
Once you add a header to a Google document, it offsets the top of the document even if empty, and receives click events. How can you then remove the header?  I am aware that you can reduce the header's effects by decreasing the page's top margin, and reducing the font size in the header—those are not the solutions I am looking for. I would like a way to actually REMOVE it.
41510
Attempting to delete questions on the mobile site on iOS causes two notification messages asking me to confirm the deletion, which it shouldn't do.  I haven't really looked into it, but it may just be that the handlers from full.js and mobile.js are both being triggered, as there seems to be the flash of the error dialog indicating something went wrong on the supposed second AJAX request when the response from the first triggers a page reload.  You can see this happening by following the method calls; the mobile view first calls   StackExchange.question.init() -&gt; StackExchange.question.fullInit()   -&gt; StackExchange.vote.init()     -&gt; u()    ...where u() sets a delegated click handler on  $("div.post-menu *[id^='delete-post-'], table.flagged-posts *[id^='delete-post-']")   ...that calls .preventDefault() on the event, but doesn't block other handlers from firing.  It then later calls StackExchange.mobile.init(), which in turn calls the method J() that sets up a similar handler directly on $(".delete-post").  Since both handlers get triggered, there's two confirmation dialogs, and two attempts to delete the post. The extra handler in mobile.js seems unnecessary, so just removing it would appear to be the easy fix to the problem.
97837
I run  (currently 7.15) since longer time and have the problem with cookies:  I need 2 cookies for non-Drupal PHP-scripts at my web site.  I set them in the hook_init of my custom module:  /**  * Implements hook_user_login().  */ function pref_user_login(&amp;$edit, $account) {     if ($account-&gt;uid &lt;= 0) {       return;     }      #drupal_set_message('&lt;p&gt;Hello, '.$account-&gt;name.'&lt;/p&gt;');     $auth  = md5(join('_', array($account-&gt;uid, MY_SECRET)));     $year  = time() + 60 * 60 * 24 * 30 * 12;     setcookie('pref_id', $account-&gt;uid, $year, '/', '.preferans.de');     setcookie('pref_auth', $auth, $year, '/', '.preferans.de'); }   The problem is, that I need to set the both cookies each time a logged in user visits the front page and not just when the user logs in.  Does anybody please have an idea how to do it, maybe by JavaScript if I can't do it regular way?
40157
Possible Duplicate:          A few days ago, I was navigating through programmers.se, wandering around.  Suddenly, while the bus was making me do some weird touching on the screen, I turned to the desktop version of the website.  I have not found a single way to turn back to the mobile version. Appending ?mobile=true to the URL didn't do anything.  I do not want to clear the cookies, I'm using them on other websites and it's a pain to write on the phone. Also, there is no way to delete cookies for a single site on my Android.  So, is there any clean way to go back to the mobile version?
62333
I'm using . For some reason, it has cached a page and won't update. For example, I added an alert('test'); statement to some JavaScript code which is loaded on the page, but Firefox doesn't see it. When I do a view source, I still see the old code.  So I'm guessing this is a cache issue. How can I fix it, or can I make Firefox never cache anything from http://localhost?
7000
When I try to use Firefox to create an account on Stack Overflow, it told me that  "Stack Overflow requires cookies for authentication -- are your browser cookies enabled for this domain?"  It works when I use IE, but I don't want to use IE.  My Question: How do I fix this?
37853
Is there a function like document.getElementById("FirstDiv").clear()?
25019
How can I close a browser window without receiving the Do you want to close this window prompt?  The prompt occurs when I use the window.close(); function.
4417
What might be an effective way to universally block or auto-accept common cookie warning banners before the web browser shows them to the user?  Eg. does a userscript (Greasefire/Tampermonkey) exist to find and thwart most cookie-warning implementations, perhaps via a regex search? Or at least can this be accomplished with an extension? (Trying not to bloat the browser with yet another extension, though.)  This applies to many outdated UK and EU websites, especially now that the .
68923
Im trying to keep away some attackers that try to exploit XSS vulnerabilities from my website, I have found that most of the malicious attempts start with a classic "alert(document.cookie);\" test. The site is not vulnerable to XSS but I want to block the offending IP addresses before they found a real vulnerability, also, to keep the logs clean.  My first thought is to have a script constantly checking in the Apache logs all IP addresses that start with that probe and send those addresses to an iptables drop rule. With something like this:  cat /var/log/httpd/-access_log | grep "alert(document.cookie);" | awk '{print $1}' | uniq  Why would be an effective way to send the output of that command to iptables?  Thanks in advance for any input!
56790
JavaScript needs access to cookies if AJAX is used on a site with access restrictions based on cookies. Will HttpOnly cookies work on an AJAX site?   Edit: Microsoft created a way to prevent XSS attacks by disallowing JavaScript access to cookies if HttpOnly is specified. FireFox later adopted this. So my question is: If you are using AJAX on a site, like StackOverflow, are Http-Only cookies an option?  Edit 2: Question 2. If the purpose of HttpOnly is to prevent JavaScript access to cookies, and you can still retrieve the cookies via JavaScript through the XmlHttpRequest Object, what is the point of HttpOnly?  Edit 3: Here is a quote from Wikipedia:     When the browser receives such a cookie, it is supposed to use it as usual in the following HTTP exchanges, but not to make it visible to client-side scripts.[32] The HttpOnly flag is not part of any standard, and is not implemented in all browsers. Note that there is currently no prevention of reading or writing the session cookie via a XMLHTTPRequest. [33].   I understand that document.cookie is blocked when you use HttpOnly. But it seems that you can still read cookie values in the XMLHttpRequest object, allowing for XSS. How does HttpOnly make you any safer than? By making cookies essentially read only?   In your example, I cannot write to your document.cookie, but I can still steal your cookie and post it to my domain using the XMLHttpRequest object.  &lt;script type="text/javascript"&gt;     var req = null;     try { req = new XMLHttpRequest(); } catch(e) {}     if (!req) try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {}     if (!req) try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {}     req.open('GET', 'http://stackoverflow.com/', false);     req.send(null);     alert(req.getAllResponseHeaders()); &lt;/script&gt;   Edit 4: Sorry, I meant that you could send the XMLHttpRequest to the StackOverflow domain, and then save the result of getAllResponseHeaders() to a string, regex out the cookie, and then post that to an external domain. It appears that Wikipedia and ha.ckers concur with me on this one, but I would love be re-educated...  Final Edit: Ahh, apparently both sites are wrong, this is actually a . IE6 &amp; 7 are actually the only browsers that currently fully support HttpOnly.  To reiterate everything I've learned:   HttpOnly restricts all access to document.cookie in IE7 &amp; and FireFox (not sure about other browsers) HttpOnly removes cookie information from the response headers in XMLHttpObject.getAllResponseHeaders() in IE7. XMLHttpObjects may only be submitted to the domain they originated from, so there is no cross-domain posting of the cookies.   edit: This information is likely no longer up to date.
10610
I have a url like   I need a javascript function to give me the 'th' value from that.  All my urls have the same format (2 letter filenames, with .html extension).  I want it to be a safe function, so if someone passes in an empty url it doesn't break.  I know how to check for length, but I should be checking for null to right?
31442
I love the way the browser remember the text I entered into a form field - especially when I'm a developer. It saves lots of my typing time.  Though, sometimes there are unwanted remembered items and need to be removed. I don't know how to do that in Firefox and Chrome. Please help!
68701
The "items per page" stat is being remembered permanently (cross device, attached to our account, not via a cookie) in the search results of any site.  However, in the , this stat is being reset whenever searching again, choosing the items per page affects only that single search:        I assume this is because stackexachange.com is not attached to ordinary account behind the scenes, so can't use the same server side cache. This can be bypassed by using a different cache probably, or use the network profile if possible.  Can it be done/fixed?
8711
I got an HTML with the &lt;body onload="window.print()"&gt;.   The question I'm trying to ask is:   Is there any way to remove the strings that the web browsers add to the printed page? Such as:   Web site from where the page was printed Page count Title of the web page Date of printing
92434
is it possible to clear all textboxes in HTML by calling a javascript function ?