Your own website

If you can edit your site's HTML, adding a tester takes a minute. The page must be served over http or https; opening an HTML file straight from your computer won't work.

Plain HTML

  1. Put the <div> where the tester should appear, for example on a font's page.
  2. Put the <script> line once on the page. Just before </body> is a good place.
HTML
<!doctype html>
<html>
  <body>
    <h1>Balford</h1>

    <div data-fontsbox-family="123"></div>

    <script src="https://fb-emb.digture.id/embed.js" async></script>
  </body>
</html>

If your site shares a layout or footer across pages, you can put the <script> line there once and only add the <div>s to individual pages.

React, Next.js, Vue and other frameworks

Render the <div> like any other element and load the script once, for example in your root layout. Fontsbox notices testers that appear later, so client-side navigation works without extra code.

Next.js (app/layout.tsx)
import Script from "next/script";

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Script src="https://fb-emb.digture.id/embed.js" strategy="afterInteractive" />
      </body>
    </html>
  );
}

// Anywhere in a page:
<div data-fontsbox-family="123" />
React, Vue, Svelte (index.html)
<!-- Once, in index.html -->
<script src="https://fb-emb.digture.id/embed.js" async></script>

<!-- In a component -->
<div data-fontsbox-family="123"></div>

Content Security Policy

Most sites don't need this. If yours sends a Content-Security-Policy header, allow Fontsbox in it:

CSP
script-src  https://fb-emb.digture.id;
connect-src https://fb-emb.digture.id;
font-src    https://fb-emb.digture.id;
img-src     blob:;
style-src   'unsafe-inline';

Add these to your existing values rather than replacing them. Next, limit the embed to your domains if you like.