I'am creating easy QT application named "webengine"
pWebView = new QWebEngineView(this);
pWebView->load(QUrl("http://technoz.ru"));
pWebView->show();
// On application close
delete pWebView;
The application creates a standard folder named "webengine" for storage and cookies. Domain sets a cookie for 24 hours. But after closing and opening the application again, the cookies lost. Сookies file created in the folder "webengine" - empty(I check it in sqlbrowser). But, if you hold on page 30 - 40 seconds, cookies are saved.
Why cookies are not saved immediately, and how to save them immediately?
During testing, it turned out that the QT(chromium) automatically stores the cookies through the browser in 30 seconds(constant) if the elapsed time is less, cookies are not saved. Is it possible to change this time? I tried to use the flag - --profiling-flush=5, but it does not help.
Given that the browser must preserve storage(cookies) when you close the browser, but it does not, whether it is a bug QT?
I can build QT from source, аnd find and change this setting in source, i think, but, perhaps this problem have other solution...
Thanks for all, found it bug:
https://bugreports.qt.io/browse/QTBUG-52121
You have to edit the cookie storage policy of your QWebEngineProfile. If you are using the default profile, use:
QWebEngineProfile::defaultProfile()->setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies)
Both session and persistent cookies are saved to and restored from disk. You can select the folder in which you will save the cookies and cache data:
QWebEngineProfile* defaultProfile = QWebEngineProfile::defaultProfile();
defaultProfile->setCachePath("your folder");
defaultProfile->setPersistentStoragePath("your folder");
Related
Note: This is not new, but I have some new insights on it.
For about three weeks now I regularly try to deploy the development-schema of my CloudKit Container to production, using the CloudKit Dashboard:
It spins for exactly a minute to then tell me "There was a problem loading the environment's status"
This is not new, many other questions face this as well:
Error CloudKit Dashboard - There was a problem loading the environment's status
Does iCloud need to be in the Production environment in order to use in Production?
iCloud dashboard: Cannot deploy CloudKit schema to Production
Apple support told me to
look at https://developer.apple.com/forums/thread/656723 (try again after a day with stable network)
use Safari and resetting browser settings to clear cache and cookies
"You may also try creating a new CloudKit container, rebuilding your schema, and then try again." => obviously doesn't work, because users have data on production
TL;DR:
Kill the timeout by running this in the console:
var id = window.setTimeout(function() {}, 0);
while (id--) {
window.clearTimeout(id); // will do nothing if no timeout with id is present
}
(the response is undefined — that's okay)
How I got there
So I started to look at the requests the site makes to the backend when I click "deploy". Chrome shows that the request to
https://p39-ckdatabasews.icloud.apple.com/r/v3/user/<container-name>/production/public/admin/deployment/status?team_id=<team-id>
is cancelled after 1.0 min.
Insight 1
The problem is with the production schema. I had used the Reset Development Environment before to make sure I hadn't messed that up myself, but this would have spared me that.
I used the Copy as cURL command (in Chrome, because it also copies the auth cookies, which Safari does not) and ran it in Terminal.
Interestingly, that does respond after 1'37 min. That's also what the X-Apple-Edge-Response-Time: 97244 header says.
If you know what to look for, the console will also tell you the the request timed out:
Insight 2
The server takes too long to respond (> 1min) and the client script times out (at 1 min)
Note: You can also get a response by right-clicking the request in Chrome and choosing "Replay XHR".
Solution
I tried to understand the JavaScript that sends the XHR request and modify the timeout, but I failed. However, you can apparently clear all timeouts that exist with
var id = window.setTimeout(function() {}, 0);
while (id--) {
window.clearTimeout(id); // will do nothing if no timeout with id is present
}
(from https://stackoverflow.com/a/8860203)
Running that while waiting for the response actually worked for me!
I have a number of web applications that run for a number of businesses, day in and day out.
The applications are in PHP/MySQL/JS Running on a remote apache server.
For many years, I have performed updates at late night when the software is not in use.
I would like to be able to perform updates to the software during working hours, if possible.
I have many times asked my clients to make sure they shut the software down at night, and close their browsers - but can never guarantee that they have done so.
I have a refresh timer in the JS that trigger a browser to refresh at 11:59. It will happen If the browser is still open.
But I would like able to perform this refresh at any open browser - when I want.
I have mulled over a few ways to do this - including cron and database values that can be read and reset - but:
I wonder if anyone has had success with achieving this?
You want to refresh all open browser tabs that are pointing at your xAMP-ish applications. A few questions:
Does the refresh need to be immediate, or can it be deferred? that is, do everyone's tabs need to be refreshed at the same time, regardless of user interaction; or is it acceptable to wait until the next request from each client, whenever it may be?
Can you schedule the refresh ahead of time (say, with at least 1 session-timeout interval lead-up time), or do you need a method that triggers refreshes immediately?
If you require immediate refreshes, with no ahead-of-time scheduling, you are out of luck. The only way to do this is to keep an open channel for asynchronous updates from the server to the clients, which is hard to do with plain Apache/PHP (see comet, websockets).
If you can make do with deferred refreshes (waiting until a user submits a request), you have several alternatives. For example, you can
expire all sessions (by calling a script that removes all the corresponding server-side session files; found in /var/lib/php/sessions/ in linux). Note that your users will not appreciate losing, say, their shopping-cart contents.
use JavaScript to check a client-side version value (loaded at login-time, and kept in localStorage or similar) against incoming replies from the server (which would load it from a configuration file or a DB request). If the server-side value has changed, save whatever can be saved to localStorage (to avoid the previous scenario), inform the user, and refresh the page.
Alternatively, if you can schedule the refreshes with enough fore-warning, you can include instructions in server-replies that will invoke the refresh mechanism when needed. For example, such replies could change your current "reset at 11:59:59" code to read "reset at $requested_reset_time".
As I understand the problem, you would want control over when the user sees 'fresh' content and when the cached stuff is okay. If this is right,
Add the following in your head content -
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
Upon receiving this header, user's browser will automatically fetch a fresh content. And you can flip on/off the above lines to suit your needs. This might not be the most sophisticated way of achieving the desired functionality but worth trying.
There are a lot of things to consider before doing something like this. For example, if someone is actively working on a page, maybe filling out a form or something and you were able to refresh their window, that could create a negative user experience. I believe some of the other answers here addressed some other concerns as well.
That said, I know from working with the Launch Darkly feature flag service that it can be done. I don't understand all the inner workings, unfortunately, but my understanding is that the service uses observables to watch for updates. Observables are similar to promises, except they continuously watch for new changes to their target. You could then force a page reload (or perhaps an alert to the user, prompting one) when the target updates.
I am quite new to LoadRunner. I am using the 12.50 community edition and am using the protocol TruClient for web.
What should i do in order to delete the cookies that the LoadRunner has accumulated while doing interaction with browser?
As suggested by tserg42, you could add a separate step inside your "Develop Script" of TruClient for adding the "Utils.clearCookies()" command inside a Javascript action.
Please find the screenshots below for adding the above
Step 1
Drag the marked step on to the script
Step 2
Step 3
Upon clicking the "JS" icon at the right corner, the arguments editor would be available for providing javascript commands. Key in the required commands - "Utils.clearCookies()".
Additionally, you can also check "Simulate new user on each iteration" checkbox from Runtime Settings --> Replay --> Simulate new user on each iteration
I guess you are looking for the function web_cleanup_cookies(). Here is some relevant information I have found about its use:
Return Values
This function returns LR_PASS (0) on success and LR_FAIL (1) on failure.
General Information
The web_cleanup_cookies function removes all the cookies that are currently stored by the for use by the script.
Note: Scripts do not use (access or modify) the cookies that are stored by your browser. Instead, each Vuser uses the cookies that are sent to the Vuser by the server host at runtime. These cookies are maintained only while the script runs. The web-cookie functions (web_add_cookie, web_remove_cookie and web_cleanup_cookies) manipulate these temporary cookies, and do not affect cookies stored by your browser.
This function is supported for all Web scripts, and for WAP scripts running in HTTP or Wireless Session Protocol (WSP) replay mode.
You could try Utils.clearCookies() method. By the way, TruClient API documentation is available online.
We’ve come across this question fairly often at Load Impact, so I’m adding it to the Stack Overflow community to make it easier to find
Q: When performing a Load Impact load test, I need to have the VUs send cookies with their requests. How do I set a cookie for a VU?
Load Impact VUs will automatically save and use cookies sent to them by the server (through the "Set-Cookie:" header). When the user scenario executed by the VU ends and gets restarted (i.e. starts a new user scenario script iteration), cookies stored by the VU/client will be cleared.
Cookies, or more specifically the “Cookie:” header, is currently the only header that is set automatically by the client. Other headers, such as e.g. “If-Modified-Since:” will not be set unless the user specifies it in the load script (this is why caching is not emulated automatically - client caching behaviour has to be programmed).
You can't manipulate the stored cookies that the VU client has, but you can override or set a cookie used by the client if you specify the "Cookie:" header in the requests you make, like this:
http.request_batch({
{"GET", "http://example.com/", headers={["Cookie"]="name=value"}}
})
I apologize if this is a "duh" question. It seems like the answer should be easily googleable, but I haven't found it yet.
I am working on a large Coldfusion application that stores a large amount of session/user data in the Client scope (ie <cfset Client.UserName = "JoshuaC"> ). I did not write this application, and I don't have the luxury of significantly refactoring it.
I've been given the task of setting the Client variables to time out after 72 hours. I'm not entirely sure how to do this. If I had written the application, I would have stored the variables in the Session scope, and then changed the sessiontimeout attribute of the CFAPPLICATION tag. As it is though, I'm not sure if that timeout affects the Client variables, or what their level of persistence is. The way the application works now, the Client variables never time out, and only clearing the user's cookies, or visiting a logout page which sets all the Client-scoped application variables to "", will clear the values.
Of course, I could create some kind of timestamp variable like Client.LastAccessDateTime, and put something in the Application.cfm to clear the client variables if that datetime is more than 72 hours prior to Now(). But there's got to be a better way, right?
Depending whether your are using a datasource or registry as a Client Store you have to set the "Purge data for clients that remain unvisited for 90 days to 3 days (=72 hours) on the
ColdFusion Administrator => Client Variables => Registry
or
Client Variables => NameOfDatabase Page.
If Client Variables are stored as cookies, then you have to adjust the expires period, when setting the cookie.
The Purge Interval on the Client Variables page only controls how often ColdFusion executes a purge operation on your client stores (= seeks for expired Client Variables in order to delete them).
I suppose you are looking for Purge Interval setting, which is configured in CF Administrator at Server Settings > Client Variables page. Default interval is 1 hour 7 min.
EDIT: This setting value is not exactly what you need. I'm sorry, see my comment about purging -- think it is more accurate.