cookies

Let the user choose between dark and light mode (save settings for every page, cookies?)

烈酒焚心 提交于 2021-01-03 01:07:46
问题 I have just recently started using javascript and jQuery so I'm not an expert and at the moment I am struggling with what I guess could be called a "basic task"? I want to include two buttons on the homepage with which the user can the website mode to either dark or light. These settings should then be remembered as the user enters the website and clicks on the different links. So far I have added the function that changes the background color and color of the font onClick but I can only do

issue with cross-site cookies: how to set cookie from backend to frontend

。_饼干妹妹 提交于 2021-01-02 06:09:11
问题 I'm currently developing my first webapp, frontend with React and backend with FastAPI . I'm trying to test it out jointly with Chrome-- see if the frontend makes the correct API calls to backend, and display the results. I've been having problems with cookies, and I'd like help. Apologies in advance for the long post – I've been going through many resources past couple of days, and at this point I'm unsure what's relevant and what's not. Frontend on localhost:8080 Backend on http://127.0.0.1

How to force clear user's cache/cookies?

拟墨画扇 提交于 2021-01-02 05:47:25
问题 Is there any way to force clear users cache and/or cookies? Especially in Safari/Webkit. Many thanks! 回答1: Yes. Trick the user into selecting the appropriate menu item which clears their cookies and cache. I kid! That would be called "social engineering" type of hacking and is inadvisable for those wishing to stay clear of legal troubles. There are a couple of tags that may be useful, depending on what you want to do: <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> <META HTTP-EQUIV="Refresh"

How to force clear user's cache/cookies?

南楼画角 提交于 2021-01-02 05:47:18
问题 Is there any way to force clear users cache and/or cookies? Especially in Safari/Webkit. Many thanks! 回答1: Yes. Trick the user into selecting the appropriate menu item which clears their cookies and cache. I kid! That would be called "social engineering" type of hacking and is inadvisable for those wishing to stay clear of legal troubles. There are a couple of tags that may be useful, depending on what you want to do: <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> <META HTTP-EQUIV="Refresh"

How can I send cookie using NodeJs request GET module?

你。 提交于 2020-12-30 06:59:05
问题 I'm working on a project in NodeJs that requires me to login to get a cookie which would be used when retrieving data. I've got following code which succeeds to log in and return me a cookie with correct formatting: var request = require('request'); var requestData = { "username":"myUsername", "password":"myPassword" } //request post request request({ url: 'http://localhost/login', method: "POST", json: requestData} ,function(err, res) { if(err){ console.log("it did not work: " + err) }

How to extend session cookie lifetime in Symfony?

旧街凉风 提交于 2020-12-29 12:01:37
问题 On accessing session data on the server side, its modified_time gets set, therefore extending its expiration time into the future. However, this does not happen for PHPSESSID cookie. While session data expiration on the server side is extended, the cookie expiration is not. If the cookie expires, the user will lose his session - he will have no session ID to give when sending a request. Is there any way to tell Symfony\Component\HttpFoundation\Session\Session to extend the cookie expiration

Why the browser doesn't send cookies while requesting a JavaScript file?

僤鯓⒐⒋嵵緔 提交于 2020-12-29 10:54:45
问题 I'm loading [site1]/script.js on [site2]/page.html with script tag. And the browser does not send cookies while requesting a JS file. Response headers: HTTP/1.1 200 OK Server: nginx Date: Thu, 02 Apr 2015 14:45:38 GMT Content-Type: application/javascript Content-Length: 544 Connection: keep-alive Content-Location: script.js.php Vary: negotiate,Accept-Encoding TCN: choice Set-Cookie: test_id=551d5612406cd; expires=Sat, 02-Apr-2016 14:45:38 GMT; path=/ Content-Encoding: gzip Request headers -

Why the browser doesn't send cookies while requesting a JavaScript file?

拜拜、爱过 提交于 2020-12-29 10:54:22
问题 I'm loading [site1]/script.js on [site2]/page.html with script tag. And the browser does not send cookies while requesting a JS file. Response headers: HTTP/1.1 200 OK Server: nginx Date: Thu, 02 Apr 2015 14:45:38 GMT Content-Type: application/javascript Content-Length: 544 Connection: keep-alive Content-Location: script.js.php Vary: negotiate,Accept-Encoding TCN: choice Set-Cookie: test_id=551d5612406cd; expires=Sat, 02-Apr-2016 14:45:38 GMT; path=/ Content-Encoding: gzip Request headers -

Difference between setcookie() and session_set_cookie_params() functions

限于喜欢 提交于 2020-12-29 10:01:13
问题 I am trying to understand the difference between PHP functions setcookie() and session_set_cookie_params(). Looks like both functions are doing the same kind of tasks but setcookie() can be used to create cookie with name & value. I tried to understand PHP manuals but no clear differences pointed out in it. Thanks 回答1: session_set_cookie_params(seconds) session_start() does two things, it creates a temporary file on the server of which to store session data, and also sends a cookie to the

Send a set-cookie header to a redirect url in node.js

人走茶凉 提交于 2020-12-29 02:55:44
问题 I am using node.js request module to fetch an id_token from an API. After fetching that id_token I want to send a redirect uri response with a set-cookie header to the redirected url . But I can't quite figure out how to do it. Here is my code: app.use("/nodejs-server/retrieveCode", function(req, res) { var clientID = 'some random string' var client_Secret = 'another random string' var code_token = clientID + ":" + client_Secret var buffer = new Buffer(code_token) var token = buffer.toString(