Giter VIP home page Giter VIP logo

dont-give-a-floc's Introduction

dont-give-a-floc

Disable FLoC on your hapi server

Build Status Coverage Status

Installation

npm install dont-give-a-floc

Usage

This module is a hapi plugin to control whether FLoC is allowed on pages served by your hapi server, using the Permissions-Policy header. You may disable FLoC to protect your users' privacy, preventing access to their cohorts via browser APIs (including in third-party scripts on your page), and opting your site out of FLoC calculations which are based on user browsing history.

Simply register the plugin to your server, optionally passing the disableFloc plugin option if you'd like it to take effect across all routes. Otherwise, you can disable FLoC on individual routes using the route.options.plugins.disableFloc option.

Example

const Hapi = require('@hapi/hapi');
const DontGiveAFloc = require('dont-give-a-floc');

(async () => {

    const server = Hapi.server();

    await server.register(DontGiveAFloc);

    server.route({
        method: 'get',
        path: '/',
        options: {
            plugins: {
                disableFloc: true
            },
            handler(request, h) {

                return h.response(`<html>
                    <head><title>My FLoC-less Homepage</title></head>
                    <body>No FLoCs given!</body>
                </html>`).type('text/html');
            }
        }
    });
})();

Extras

dont-give-a-floc's People

Contributors

devinivy avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.