Friday 31 July 2015

How to create a cookie notification for countries in the EU

Sites that use cookies must present a notice about cookies to users from the European Union (EU). Seeing the notice, users should be able to do one or more of the following:

  • Agree and use the site
  • Learn more on what cookies are being used
  • Optionally be able to block these cookies.

If you use the Blogger platform and use cookies only from Google


Google can display the following notice without you having to do anything:
This site uses cookies from Google to deliver its services, and to analyse traffic. Information about your use of this site is shared with Google. By using this site, you agree to its use of cookies.

All other sites


  • Modify Google's message, link to a landing page on your site which has links to privacy policies of all entities whose cookies you use. This blog uses this approach. See [2].
  • Forego Google's notice entirely and instead use one of the tools suggested by Google in [1] e.g.  Cookie Consent by SilkTide. You will also have to detect the country of the user.

Testing


  • If you use are on blogger, use a domain that belongs to a country from EU e.g. yaanqing.blogspot.fr (France).
  • If you are on blogger but use a custom domain, see this blog on how to test. Basically, append "prx.gb.teleport.to" without quotes to the domain e.g. custom-blogger-domain.com.prx.gb.teleport.to

Going further


If you stop after doing the above, the user can continue to use the site. However, if you would like to go further, you can also allow the user to block the cookies and still be able to use the site. This has may be done by using a cookie (or a local database) whose only purpose is to say which cookies the user wants! The site's code would then inspect this cookie before using code that creates any cookie.

Reference

  1. Google has a page that explains the above in detail.
  2. The following code links to the Privacy page in this blog. The code and the page are the only things that need to be done.

<!-- code to be inserted just before the end tag for HEAD -->
<script type='text/javascript'>
  cookieOptions = {
    msg: &quot;This site uses cookies from Google to deliver its services, and to analyse traffic. Information about your use of this site is shared with Google. By using this site, you agree to its use of cookies.&quot;,
    link: &quot;http://yaanqing.blogspot.com/p/privacy.html&quot;,
    close: &quot;Got it!&quot;,
    learn: &quot;Learn more&quot;
  };
</script>

Wednesday 1 July 2015

How to view Flash content in browser on Android Lollipop

There are useful websites that still use Flash. For example, take a look at this nice site on Yoga which shows each asana in animation.

Unfortunately, this Flash animation cannot be seen on Chrome for Android. Many web browsers prefer HTML5 and do not support Flash.

However, some browsers like UC and Maxthon can still display Flash content. Though Adobe has discontinued development of Flash, the last released versions of Flash work reasonably well with these browsers. With a supporting browser, and with Flash installed, you can still make use of sites with Flash.

Steps to view Flash content

  • Install UC Browser from Google Play Store. This browser is quite popular and is apparently safe for use.
  • After installation, launch the browser and go to a page that needs Flash - for example, the said site on Yoga.
  • Click on the icon which is displayed in place of the Flash content.
  • The browser will ask you to enable support for installation from an unknown source - it needs to download Flash from Adobe's site and install it. Say OK.
  • When you are returned to the page, check if the Flash animation plays properly.
  • Now disable installation from "unknown sources": Android settings->Security->uncheck Unknown Sources.

Switching easily from browser to app


For users who need a easier way to switch from Chrome to UC Browser when a site needs Flash, the Flashify app may be useful. Normally you copy the URL, open the target app, for example UC or YouTube app, and paste the URL. But with Flashify installed, select the browser's menu and share with Flashify, which suggests suitable apps to open the URL.

Popular posts