How to get cookie by vue-electron

scenario: use electron to package vue applications.
attempt: an .html demo is established. The session of the main process can be obtained through node, and the cookie can be obtained

<script>
    var session = require("electron").remote.session;
    function getCookie(name) {
        session.defaultSession.cookies.get({ url: "http://www.github.com" }, function (error, cookies) {
            console.log(cookies);
        });
    }
</script>

problem: modules that use node in vue will not be obtained, resulting in not getting cookie

Apr.13,2022

electron applications have two processes, one browser and one node. Naturally, you cannot directly obtain the browser's cookie in node. You need to rely on the api provided by electron to communicate


refer to stack overflow , and you can introduce node module into index.html. Then use

in the .vue file
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf7b18-315e0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf7b18-315e0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?