cookies

Is !document.cookie reliable?

天大地大妈咪最大 提交于 2020-01-02 01:21:08
问题 I'm wondering if using the following Javascript code is reliable: if (!document.cookie) { alert('Cookies are disabled.'); } I've tested this in IE, Firefox and Chrome and it seems that when you disabled cookies, the document.cookie object becomes unavailable. Does anyone have any experience with this method working/not working? Many Thanks Stephen Additional I'm well aware that this method requires JavaScript to be enabled on the client. I'm also aware of other server-side/JavaScript

Allow a Google Colab domain cookies on chrome

℡╲_俬逩灬. 提交于 2020-01-02 01:10:18
问题 I am trying out Google Colab, but then I keep getting this pop up box that says: Error Could not access the resources needed to display output. This is probably because third-party cookies are not allowed by your browser. NotSupportedError: Failed to register a ServiceWorker: The user denied permission to use Service Worker. While turn off Block third party cookies worked for me from here, I would like to keep the setting to be turned on at all times for the sake of our privacy. Currently I

iPhone App Cookie Delay

て烟熏妆下的殇ゞ 提交于 2020-01-01 19:18:13
问题 My iPhone app has a UIWebView that loads a page containing javascript that sets a cookie. It seems that if i set a cookie and exit the app within 10-15 seconds then the cookie is never saved, however if i set the cookie, wait 10-15 seconds THEN exit the app, the cookie is saved. Anyone have any info about why their is a delay and how to go about having the cookies saved immediately. 回答1: The only workaround i was able to come up with is to save the cookies to the user defaults right before

How to delete the same cookie in php from two different path

自古美人都是妖i 提交于 2020-01-01 19:08:29
问题 My problem is that I want to delete the cookie from the page which is in the different directory from the page who sets the cookie but due to the path restriction PHP is not deleting the cookie. Has anyone any solution? 回答1: When you set and delete the cookies, pass the same path: setcookie('cookie_name', "SOME_VALUE", time()+3600, '/'); //to set setcookie('cookie_name', "", -1, '/'); //to unset http://php.net/manual/en/function.setcookie.php http://www.phpbuddy.com/article.php?id=12 来源:

Jquery cookie to remember last state of drop down menu

断了今生、忘了曾经 提交于 2020-01-01 19:07:50
问题 Can anyone help me with this, I can't find a script on the internet that does this in jQuery. I need to remember the last state of drop down menu so that on page load the drop down option is already selected. The cookie expiration date should be 90 days or let me specify in the script. Since I already use jQuery on my page I want this cookie script to use jquery, jquery cookie plugin. Thank you in advance. I'm not a programmer, but I try. <body onLoad="GETcookie()"> <select onChange=

Is this an appropriate login and registration encryption system

旧巷老猫 提交于 2020-01-01 12:25:34
问题 Apparently, hashing the username and password and saving them as cookies and logging in with sanitized cookie data is not good enough for you people (or my site's safety). Is this approach good enough? Registration procedure: $salt= date('U'); $username= hash('sha256', $salt. $_POST['username']); $password= hash('sha256', $salt. $_POST['password']); $token = hash('sha256', $salt. (rand(1,10000000000000000000000000000000000000000000))); To login manually, users type in their username and

Chrome does not allow cookies with expirations less than 4 hours

霸气de小男生 提交于 2020-01-01 12:24:10
问题 I can't seem to set cookies with short lifespans in Google Chrome. They're either not getting set, or are immediately being deleted (can't tell which, although the result is the same either way). This only occurs if the expiration is 4 hours or less in the future. Identical code works fine if the expiration time is greater than 4 hours and the issue does not occur in Firefox or Safari. Here's an example: Does not work: exp = new Date(); exp.setMinutes(exp.getMinutes() + 240); document.cookie=

Save OAuth WRAP access tokens directly on client machine in a cookie?

不想你离开。 提交于 2020-01-01 12:07:50
问题 I'm planning to setup a website that would access an oauth wrap framework. I was thinking of storing the access token on the client machine as it is. I do NOT want to maintain a database of temporary tokens, etc on the server. Should I be doing do? Or should I encrypt it? 回答1: First, why are they not using OAuth 2.0... You can store the OAuth credentials in a cookie or better yet, in HTML5 local storage. It should be encrypted so that only the server has access to this cookie and only the

Remove or Reset Cookies

被刻印的时光 ゝ 提交于 2020-01-01 11:49:40
问题 I am setting a cookie Request.Cookies("TemplateName").value on one of my pages(page 3) of my application. Now I can navigate from page 3 to page 4 and page 2 and retain the value of the cookie. But now when I logout and login again it still has the value, how can I reset the value of the cookie to be blank "" when I start a new instance? I tried: Request.Cookies("TemplateName").Expires = Now Request.Cookies("TemplateName").value = "" On my homepage, but the cookie still retains the value on

Remove or Reset Cookies

隐身守侯 提交于 2020-01-01 11:49:28
问题 I am setting a cookie Request.Cookies("TemplateName").value on one of my pages(page 3) of my application. Now I can navigate from page 3 to page 4 and page 2 and retain the value of the cookie. But now when I logout and login again it still has the value, how can I reset the value of the cookie to be blank "" when I start a new instance? I tried: Request.Cookies("TemplateName").Expires = Now Request.Cookies("TemplateName").value = "" On my homepage, but the cookie still retains the value on