Menu

Search

InstantASP Support

Help & Support


Adding a "We Use Cookies" notice to your InstantForum or InstantKB installation


Common Questios

In some countries it's a requirement to display a notice to end users to inform them that your InstantForum or InstantKB installation uses cookies. We've we don't have this functionality out the box (just yet) it's very simple to add this to either InstantForum or InstantKB in just 20 lines of code.

The Code

HTML

<div class="row cookie-notice">
<div class="padding">
This site uses cookies. <a href="#" class="btn-sml close"><span>Got It</span></a>
</div>
</div>

JavaScript

<script type="text/javascript">

$(document).ready(function () {

// name for cookie to track if we've accepted cookies
var ckName = "cookiesOK";

// get cookie to track if we've already accepted cookies
var ckVal = iasp_GetCookie(ckName);

// show cookie notice if we've not already accepted
if (!ckVal) {
var $notice = $(".cookie-notice");
$notice.slideDown('slow');
$notice.find(".close").click(function () {
iasp_SetCookie(ckName, "1");
$notice.slideUp('slow');
});
}

});

</script>

CSS

<style>
.cookie-notice { font: normal 10pt Arial; background:#F9FFDA; border-bottom: 1px solid #ccc; color:#222; position: fixed; z-index: 1; text-align: center; display: none; }
.cookie-notice .padding { display:inline-block; padding: 12px; }
</style>

Putting it all together

To make it super simple to implement the above code we've compiled a single user control attached below.

1. Download the attached ZIP file below.

2. Extract the ZIP file to your desktop. This will create a single folder called "CustomControls". Copy the CustomControls folder into the root of your InstantForum or InstantKB installation.

3. Add a reference to the user control from your InstantForum or InstantKB MasterPage. Your MasterPage file can be found within the root of your active skin folder (skins/classic by default) and is called MasterPage.Master.

Open MasterPage.Master in NotePad or similar text editor.

Add the following tag to the top of the MasterPage.Master below the exsting <%@ Register $> tags at the very top of the master page...

<%@ Register Src="~/CustomControls/CookieNotice.ascx" TagPrefix="uc1" TagName="CookieNotice" %>

Add the following highlighted tag just before the end </form> tag within your InstantForum or InstantKB master page...

<uc1:cookienotice runat="server" id="CookieNotice" />

</form>

</body>
</html>

How It Looks

The screen grab below shows the cookie use bar in action...

That's It!

You can of course customize the text displayed to end users. We've tried to keep this example very simple to show you simply how to achieve this functionality.Of course if we can assist with any customization questions please don't hesitate to contact us or open a support ticket.


Attachments


CustomControls.zip 1.00 KB, 512 views

Optionally provide private feedback to help us improve this article...

Thank you for your feedback!


Comments require login or registration.

Details

Product: InstantKB, InstantForum
Type: HOWTO
Article not rated yet.
Article has been viewed 6.8K times.
Last Modified: 2 Years Ago
Last Modified By: Ryan Healey

Options

Similar Articles


Tags