dcef3 - Google Maps welcome always showing - delphi

Whenever I navigate to maps.google.com via my dcef3 instance (TChromium), the "welcome" bit always appears over the top. Can I turn this off somehow with some setting? If I go to maps.google.com in Chrome or Firefox, it doesn't appear.
I thought it may have been something to do with cookies maybe, so tried setting CefPersistSessionCookies to true but no luck. Maybe I need to set an Option property with TChromium or handle some other event? I have made no other changes to the default values for TChromium.

It seems I needed to have a cache_path set (CefCache). According to doco:
cache_path The location where cache data will be stored on disk. If
empty an in-memory cache will be used for some features and a
temporary disk cache will be used for others. HTML5 databases such as
localStorage will only persist across sessions if a cache path is
specified.
So it seems (almost obviously to me now) that cache is needed.

Related

Cookies not saved

I have an app that reads a jpg file and displays the embedded GPS location on a google map using a TChromiumWindow.CreateBrowser component. (Delphi Berlin and CEF4Delphi latest version). Every time I run it I have to accept or deny cookies.
How do I make it remember my cookie choice ?
I have tried setting up a ICefCookieManager cookie manager but there is no option to set a cookie store and the cache folder remains empty. Also looked at a number of GlobalCefApp ideas I found on the internet without success.
The cookies are saved with the cache files.
Set the cache directory in GlobalCEFApp.Cache before the GlobalCEFApp.StartMainProcess call in the DPR file like this :
GlobalCEFApp.Cache := 'c:\my_custom_cache_directory';
Make sure that the windows user executing your application has write privileges in the cache directory.
With this setting you will only have to deal with the "accept or deny cookies" dialog the first time you visit a web page or when the cookies expire.

How can I restore a WKWebView with its history intact? [duplicate]

I am trying to figure out how to restore the back forward list in a WKWebView. Apple defaults the BackForwardList to be readonly. However, FireFox, Chrome, and other mobile browsers are able to restore it each session.
This is how FireFox restores it on iOS: https://github.com/mozilla-mobile/firefox-ios/wiki/History-Restoration-in-WKWebView-(and-Error-Pages)
Here is the JS/HTML code that's used to access the DOM History API: https://github.com/mozilla-mobile/firefox-ios/blob/041c85483b1aa4a4e357d8bd9419550e4f20347a/Client/Assets/SessionRestore.html
In order to load this file and restore a WKWebView's history, do you need to spin up a local server within the app?
It seems like you would need to in order to access a local:// url that points to this JS file.
Yes, that's what they are doing, according to WebServer.swift. There are many references in the code to internal://, and an InternalURL struct in URLExtensions.swift. There are session restoration things in that file as well, such as var isSessionRestore: Bool.
If you haven't already, clone the project and open it in Xcode for easier navigation and searching.

Change cache storage location for individual WebBrowser control instances

First of all, thank you all for taking time to read the question.
I am embedding Microsoft WebBrowser ActiveX control into my application. Normally such a WebBrowser instance saves cookies and caches to the system default location C:\Users\${foo}\AppData\Roaming\Microsoft\Windows\Cookies.
I want to store cookies in another directory. SFAIK that WebBrowser control uses WinINet to access caches and cookies. I think I should call InternetSetOption with a proper option flag. Can anybody shed some light on it?
WinInet does not give you the option of programmably changing the paths of its storage folders. The location of the Cookies and Cache folders are part of the calling user's profile instead.
Specifically, they are determined by the CSIDL_COOKIES and CSIDL_INTERNET_CACHE shell folders (FOLDERID_Cookies and FOLDERID_InternetCache on Vista+), which are configured in the following Registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

How to force a browser to download page content resources?

Too frequently I see issues where customers/clients have to refresh the webpage, typically after clearing their history/cache, only to find out that the webpage is perfectly fine.
Is there any way to add a version or just force the browser to download all resources, such as scripts, images, ...etc?
One common way to do this is to append a nonce or version number to the URL of these resources:
myStylesheet.css?ver=1.1
logo.png?ver=13.1
When you change the file, you update the version number and any cached resource gets updated.
You can also ensure you are using the same version number (or whatever) for every time you make any changes to the codebase.

Rails passing additional params in some tag helpers

Currently image_tag("file.jpg") produces normal image html tag, BUT src="file.jpg**?7485793246**" What are those numbers anyway and how to disable them?
Those are refered to as Asset Timestamps they can be used by the server to cache files. For example lets say you have a file called file.jpg on your server, you can set up your server to tell browsers like firefox to cache the file.jpg so the next time that browser visits your web-page it loads faster because file.jpg was already in memory.
The problem comes when you upload a new file.jpg because even though the image is different, your old users who have the image cached will still see the cached image, that is where asset timestamps come into play. Those numbers represent a timestamp of when the file was updated, so if you replace file.jpg?123456789 with file.jpg?987654321 then the user's browser will not use the cached version.
http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html
long story short, it is only there to help you, and doesn't affect the way the file behaves at all. Users can still download the file and operating systems will see it as being a valid .jpg.
thats your development mode making sure that nothing gets cached so that if you change the image it actually gets to the browser. the production version won't have it.
Solved, add this to environment.rb => ENV['RAILS_ASSET_ID'] = ''
Conclusion: yes, its a good rails stuff, but when you deal with ie6 and PNG images it can break your script. So be careful.

Resources