Bits & Bytes

Posts Tagged ‘cookies’

How to Stop Losing Saved Flash Games

If you play Flash games with any frequency, you have probably noticed that, after a while, your saved games will disappear. Then you have to start the game from scratch and play through the entire game from the beginning again. Here, we show you how to fix this problem.

Expanding your browser’s cache does not prevent games from being erased. In fact, saved Flash games are stored in a location that is used across browsers. So, you can play the same game and continue your saved progress in any browser. However, you need to follow the steps below to prevent your saved games from being prematurely erased.

First, navigate to a page with a game on it, like this one.

Next, right-click inside the game window to bring up the context menu shown below and then left-click “Settings…” in the context menu.

This opens the Adobe Flash Player Settings dialog shown below. Left-click the “Local Storage” tab so that your settings dialog looks like the one below. Notice that the dialog asks how much storage can use. This means that the storage is based on the website that you playing on, but not the game. By default, the value will be something small, like 10 kilobytes. With the default setting, the storage will run out fairly quickly, and you will lose all of your saved games, unless you increase the storage maximum.

To increase the storage, left-click and drag the slider to the right to increase the storage limit. I would recommend setting it to “Unlimited” so that you don’t have to worry about losing your progress. Note that you can see how much space is currently being used too. When you are done, left-click the close button and play some games!

Beware of clearing your browser’s cache. This may cause the Flash games to lose their storage, indirectly.

PHP Cookies, Domains, and Subdomains (oh my!)

Programming in PHP on the web is always interesting, and working with cookies is no exception. For instance, you can set a cookie like this:

setcookie(“a”, “123”);

where “a” is the name and “123” is the value of the cookie.¬† Then you would probably expect it to be available wherever¬† you go in your domain, which we’ll call (Note: do not expect your cookie information to be available if you go to a page on another domain, such as However, what happens when you have a link on your page that takes you to one of your subdomains, like The page in the subdomain needs the cookie you set, but when you arrive at the new page, the cookie is empty. What happened?

Even though crossing from to may not seem like much, it is to a cookie. Cookies are not, by default, available across the subdomains of your domain.

So, when you are on, you can set your cookie with name “a” and value “123” and expect it to be available on any page that has as part of its URL. However, if you want your cookie to be available as well on, or on all of your subdomains and in any of your directories on your domain, you will need to add a few parameters to the call to setcookie(), like this:

setcookie(“a”, “123”, 0, “/”, “”);

  1. “a” is the name of the cookie
  2. “123” is the value of the cookie
  3. 0 is the time of expiration. The default is 0, which means the cookie will expire at the end of the session, which is when the browser closes.
  4. “/” refers to where this cookie works. Setting it to “/” will make it available over the entire domain specified in #5. Otherwise, it will be set for the directory that your script is in, which may not be desired.
  5. “” is the domain over which this cookie remains valid. Adding the “.” to the front of “” will keep the cookie valid over all subdomains of the domain. Do not put “www” in this parameter unless you want the cookie to be valid only over the domain “”. If you do, any page with an “” URL then will not have access to the cookie.

Always remember: you must set a cookie before printing any output to the browser.

This function call will return true if the cookie was successfully set, false otherwise.


© 2007–2022 LLC. All rights reserved.