I'm currently working on a web view that takes a js plugin via .evaluateJavaScript(). The js script will read a cookie and send it along with requests to a url that is different from the url of the web view.
I have this cookie in the URLSession.shared.configuration.httpCookieStorage, and initialized the webView with the default init() without passing any parameters. However, upon injecting the js, the required cookies does not appear in the webpage's storage (using safari inspector). I tried to do an output of the
webView.configuration.websiteDataStore.httpCookieStore.getAllCookies(), and the result shows the specific cookie is there. Hence I'm confused about it. Anyone could help me with that would be greatly appreciated.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi there, I'm currently initializing a cookie that is supposed to be http only for the security purposes. However, I can't find a way to set the cookie to be http only. Could anyone point me to the right direciton?
let cookie = HTTPCookie(properties: [
.domain: "aaa.bbbb.ccc",
.path: "/",
.name: "token",
.value: "aaa.bbb.ccc",
.version: 1,
.secure: true,
.expires: NSDate(timeIntervalSinceNow: 12345)
])!