First published: 31st July 2019
Changes to Hong Kong's alcohol sales law came into effect on 30 November 2018 and the Tobacco and Alcohol Control Office (TACO) of the Department of Health has been contacting the owners of websites selling alcohol to advise them to comply with the new regulations. Here we describe and discuss some simple changes made to one such site in order to comply.
An Administrative Assistant contacted the site owner by telephone and email stating, "As at 16 July 2019, we cannot locate (i) the Chinese and English versions of the prescribed notice and/or (ii) a mechanism for receiving age declaration by customers on your company website showing that your company has complied with the law requirement under Part 5 of the Dutiable Commodities (Liquor) Regulations (Cap. 109B)." with helpful attachments detailing the requirements and the website pages that did not comply.
Basically, the requirements are to display a notice saying that alcohol sales to a minor are prohibited, and, when making an alcohol sale, require the buyer to declare that they are 18 or over. The wording of the notice must be copied from the legislation verbatim, and both the Chinese and English text is required.
Complying with the notice requirement was simply a matter of adding it to the page templates:
<div class="legalnotice">
<p>根據香港法律,不得在業務過程中,向未成年人售賣或供應令人醺醉的酒類。
<p>Under the law of Hong Kong, intoxicating liquor must not be sold or supplied to a minor in the course of business.
</div>
By defining a class for the notice, suitable CSS rules can format it:
.legalnotice {
color: #151c86;
background-color: #fbdceb;
float: right;
text-align: center;
padding: 1em;
}
Here, the colour and background colour of the notice have been chosen to match the blue and pink colour scheme of TACO's sample prescribed notice. There is no requirement to use those colours, but it does make the notice stand out and make it easy for TACO to recognise it. The sample prescribed notice, as displayed on the TACO website, does have a problem: as an image, the text is not accessible to people with some disabilities, so to conform with WCAG, Alt text for img
elements must contain all text in the image. The Alt text on the TACO website is merely, "Prescribed notice sample".
Complying with the requirement for the buyer to declare they are 18 or over is a little more complicated. On the site in question, all payments are processed through Paypal. Paypal requires all account holders to be 18 or over, so is payment by Paypal effectively a declaration that the buyer is 18 or over? When asked, TACO responded, "I write to acknowledge receipt of your email. We will study the case and revert to you later. Thank you."
In the absence of a decision on whether "declaration-by-payment method" is sufficient, how can it be implemented? The buyer must be forced to make the declaration before being allowed to pay, and, looking at the detail of the legislation, there should be some record of the declaration that can be used later if there is a problem. If this is implemented in JavaScript, it could be disabled in the client browser. When the declaration is made, it needs to be linked to a particular transaction to remove any doubt whether the buyer actually made the declaration. The solution adopted was:
<script async="" src="/trolley.js"></script>
<input type="checkbox" name="custom" onchange="showSubmit(event)" value="I declare that I am over 18 years old. 謹此聲明本人已年滿18歲">I declare that I am over 18 years old.<br>謹此聲明本人已年滿18歲
</div>
<noscript><p class="jswarn">Please enable JavaScript for checkout options. 請為結帳選項啟用JavaScript。</p></noscript>
<input type="image" src="http://images.paypal.com/images/lgo/logo4.gif" alt="Pay using PayPal" style="display: none;" name="submit">
So, the PayPal button is hidden by default. If the client browser has JavaScript turned off, then the user is asked to turn it on to see the checkout options. When the user selects the declaration checkbox, a JavaScript function is called. The script trolley.js is
// Hide / Unhide the submit field (for age declaration)
function showSubmit(event) {
var blist = event.target.parentElement.parentElement.children;
for (i = 0; i < blist.length; i++) {
if (blist[i].name == 'submit') {
if (event.target.value.match(/over 18/) && event.target.checked ) {
blist[i].style.display = 'inline-block';
} else {
blist[i].style.display = 'none';
}
}
}
}
This reveals the PayPal button when the declaration is selected, and hides it if the declaration is unselected. The name of the declaration field, "custom", is significant. All the values in the form are submitted to Paypal, and the custom value is a pass-through variable that is returned to the vendor with the payment notification. Therefore, the vendor receives the payment notification, with the goods ordered, along with the declaration that the buyer is over 18.
Of course, this does not prevent someone constructing a shopping cart and submitting it to Paypal, bypassing the control on the website, but the vendor can check for the text of the pass-through variable and take appropriate action.
The changes made to the site in question were reported to the TACO, and they responded, "It is noted that your company has taken measures in respect of the prescribed notice and age declaration requirement under Regulation 42 of the Dutiable Commodities (Liquor) Regulations (Cap.109B). We have no further comments. Thank you." As is usual with Government departments, they do not make a definitive statement on whether it complies, but they do not describe any further faults.