Browsers and Cookies
Browsers
The most likely applications you will use on your computer are the browser, text editors, and terminal. Let’s talk about the browser! Popular browsers include Chrome, Edge, and Firefox.
Shortcuts
Getting familiar with common shortcuts can really pay off in the long run to navigate within your browser. Note that Ctrl probably maps to Cmd on a Mac.
- Middle Button Click in a link opens it in a new tab
- Ctrl+T Opens a new tab
- Ctrl+Shift+T Reopens a recently closed tab
- Ctrl+L selects the contents of the search bar
- Ctrl+F to search within a webpage. If you do this often, you may benefit from an extension that supports regular expressions in searches.
Search operators
Web search engines like Google or DuckDuckGo provide search operators to enable more elaborate web searches:
- “bar foo” enforces an exact match of bar foo
- foo site:bar.com searches for foo within bar.com
- foo -bar excludes the terms containing bar from the search
- foobar filetype:pdf Searches for files of that extension
- (foo|bar) searches for matches that have foo OR bar
More through lists are available for popular engines like Google and DuckDuckGo
Searchbar
The search bar is a powerful tool too. Most browsers can infer search engines from websites and will store them. By editing the keyword argument, you can create fast searches on specific websites (for example, you may use YouTube or Wikipedia often and want to search them directly).
- In Google Chrome they are in chrome://settings/searchEngines
- In Firefox they are in about:preferences#search
Cookies Add State to HTTP
HTTP is a stateless protocol, which means each request and response is independent from all other requests and responses. However, many features on the web require maintaining some form of state. Without cookies, it’s difficult for a server to recognize repeat visitors
Websites can provide a better user experience when state is maintained
For example, when you log into your email account, you can stay logged in across many requests and responses. If you enable dark mode on a website and make subsequent requests to the website, you want the pages returned to have a dark background. If you’re browsing an online shopping website, you want the items in your cart to be saved across many requests and responses. Browser and servers store HTTP cookies to support these features.
Think of cookies as pieces of data stored in your browser. These cookies encode state that should persist across multiple requests and responses, such as your dark mode preference or a list of items in your shopping cart. In future requests, your browser will automatically attach the relevant cookies to a request and send it to the web server. The additional information in these cookies helps the web server customize its response.
A cookie is just a name, value pair. For example, a cookie darkmode=true has name darkmode and value true.
If domain of cookie matches domain in url, then cookie is a “first party” cookie. Otherwise, it’s a “third party” cookie For example: If you visit cnn.com, the Adsystem cookie is installed
Common types of cookies are for:
- Advertising
- Analytics
- Social Media
Privacy extensions
An ad blocker not only blocks most ad content but it will also block sketchy and malicious websites since they will be included in the common blocklists. They will also reduce page load times sometimes by reducing the amount of requests performed. You may like to investigate the following privacy extensions (installing not required by this class).
- uBlock origin (Chrome, Firefox): block ads and trackers based on predefined rules.
- Privacy Badger: detects and blocks trackers automatically. For example when you go from website to website ad companies track which sites you visit and build a profile of you
You can find about more addons of this kind here
If you’re interested in seeing just how identifiable you are when you browse, check out Cover Your Tracks.
References
- CS 161 Cookies
- Missing Semester, MIT, 2020
- Content acknowledgement: Brad Reaves