D
D
Dmitry Arushanov2018-11-14 18:24:20
safari
Dmitry Arushanov, 2018-11-14 18:24:20

How to track cookie changes in safari extension similar to chrome?

Good day to all. There is this code from chrome extension

chrome.cookies.onChanged.addListener(function(changeInfo){
  // Some logic goes here
})

It is necessary to implement similar functionality for the safari extension.
Tried to pick document.cookie in global page - but they are empty.
I found solutions in which cookie values ​​were received in Injected scripts and sent to the global. But I need to get this value not once.
An essence in what ekstenshen works with service. And the situation when the extension is running, but you are not logged in and log in through the web-app (website) - then you need to pull up the session and make sure that the extension is authorized.
In chrome, I checked whether the value of the cookie had changed, if so, then I pulled up the session - if the session was active, then I logged in. or the answer was 401.
Constantly pulling the server is not an option.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question