Note that there are some explanatory texts on larger screens.

plurals
  1. POChecking Logged in status with Chrome Extension
    primarykey
    data
    text
    <p>I am building my first chrome extension for our website. Not too fancy, i just need to see if user is logged in and if so i would send an ajax request and grab some user data from server and show it in extension popup. At the moment i think, i should check the presence of auth cookie to make sure that user is logged in. I want to, is it a good idea to check the presence of auth cookie for this purpose or should i be taking some other path? This is the code i use to check if user is logged in </p> <pre><code>isLoggedIn: function () { var cookie = document.cookie(this.cookieName); if (console) console.log(cookie); if (cookie) { return true; } return false; }, </code></pre> <p>I know i can't access cookies right away from background process and i have to pass cookie info from content script to background process but i think it explains the idea. Any suggestions?<br> <strong>Edit:</strong> I have read <a href="http://ttcremers.blogspot.com/2010/01/accessing-site-cookies-from-chrome.html" rel="nofollow">this article</a> to send cookie data from content script to popup.js which is in "default_popup" setting in manifest.json file. but i can't seem to pass cookie data back to popup.html and js files referenced there. How can i make it work? Here is my manifest.json file</p> <pre><code>{ "name": "Camba TV - Visual Security Made Simple", "version": "1.0", "description": "My Cameras on Camba.tv", "icons": { "48": "icon48.png", "128": "icon128.png" }, "browser_action": { "default_icon": "icon.png", "default_popup": "popup.html" }, "content_scripts": [ { "matches": ["http://*/*", "https://*/*"], "js": ["Cookies.js"] } ], "permissions": [ "http://localhost:50477/", "tabs", "http://*/*", "https://*/*", "cookies" ] } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload