A magnifying glass held over a trail of footprints, one print enlarged under the lens
Trusted third parties7 min read

What can my site do with JavaScript?

People ask this in different words: why did my slider stop, can you add a countdown, can you write me a little script. The honest answer is that your site does plenty, and almost none of it involves anyone writing code for you.

The prompt

“The menu button on [the page] does nothing when I tap it on my phone. Fix it and show me before it goes live.”

Signed in, Get my prompt fills in your site for you. Otherwise press Copy and fill in the [bracketed] parts. First time? Connect your AI to bernard once: Use your own AI (opens in a new tab).

There are four ways something bernard owns can run on a bernard page. A fifth way, on every bernard account, is code your assistant writes for you, which bernard checks before it goes into your draft.

1. Built-in behaviours

bernard owns a small set of tested pieces - the ones almost every site needs - and switches one on with a marker in the page. No code is written, so there is nothing to go wrong quietly.

What you wantHow to ask
A menu button that opens and closes“The menu button on my phone does nothing. Fix it.”
A carousel of photos or quotes“Turn the three photos on the home page into a carousel with arrows.”
A big slideshow at the top of a page that will not move“The slideshow on my home page is stuck on the first picture. Make it work.”
A list where clicking a row opens more about it“On the projects page, clicking a row should open its details underneath.”
Category buttons that show only the matching projects or posts“The category buttons on my news page do nothing. Make them filter the posts.”
A box that narrows a long list as you type“Put a search box above the workshop list that hides the ones that do not match.”
Hover effects that came across brokenAutomatic. Nothing to ask.
Content that arrived invisible after a moveAutomatic. Nothing to ask.
A contact or enquiry form“Add a contact form to the About page.”

Three of those are worth a word, because they are the shapes that most often arrive dead from an old site. A full-width slideshow usually had arrows drawn by the old site’s own code rather than put in the page, so after a move there is nothing left to click. bernard puts its own back: click the right-hand side of the picture to go forward, the left-hand side to go back, use the dots underneath, or the arrow keys. And a list of rows that opened when you clicked one, a project list or a set of questions, comes across with everything still in it but nothing to open it. bernard re-connects each heading to the panel below it, opens one at a time, and keeps it working for people using a keyboard.

Category filters are the third. On many old sites, clicking “News” or “Heritage” asked the old server for a fresh list, and that server does not come with the move. Everything was already on the page, though, so bernard filters it right there: pick a category and only the matching items show, pick “All” and they all come back, and the buttons on the phone version follow along.

The last two rows are worth knowing about even though there is nothing to do: when a site moves, hover effects and fade-in content often depended on the old site’s code, and bernard rebuilds both as it imports.

Your old site’s own code, such as its theme’s menu, loader or animations, is kept when the move captured it and it does not make the page slower or add errors. Otherwise it is removed and listed in the import record, and bernard’s own behaviours above take its place where they can. If something on a moved page still looks wrong, say which page and what you expected.

One limit worth knowing. These behaviours work on the pages that came across with your site, which is where bernard put them as it imported. A brand-new page your AI writes from scratch does not have them yet, so a menu button on a new page will not open until bernard adds the behaviours to new pages as well. Ask your AI to check it by using it rather than by looking at it, and if it is a new page it will tell you and build the same thing a different way meanwhile.

2. Checked outside tools

Diagrams, charts, a PDF viewer, a photo lightbox, code samples, mathematics and a swipeable carousel come from well-known makers, and bernard runs them from a checked list at a pinned version. See Embed a calendar, a diagram, a chart or another tool on my site for what is on the list today, what is waiting, and how to ask for something that is not. A HubSpot form works today: bernard shows HubSpot’s own form in a frame on your page. See Connect my website form to HubSpot.

3. Tracking and chat tags

Google Analytics, the Facebook pixel, Clarity, Plausible, Fathom and Intercom are not put into your pages at all - bernard serves them from its own side, and only to visitors who have agreed to cookies. Ask for the one you want and give the id your provider shows you. Never paste the snippet: it would be removed, and the id alone is all bernard needs.

4. Animations from bernard’s library

Numbers that count up, sections that appear as people scroll, words that come to life: bernard has a library of 24 animations, checked in a real browser by its own tests, and it uses your site’s main colours where it can find them. They work on every bernard site. See How do I add an animation to my site?.

5. Code your assistant writes, checked first

Some things have no ready-made part, such as a calculator built for your business. Your assistant can write the code, and bernard checks it before it goes into your draft. It checks that the code does not load code from other websites, that it talks only to the places it names, that it does not send anything until a visitor does something, such as pressing a button, and that it does not use tricks to recognise or follow your visitors. Code that fails a check does not go on your page (the full list is in Is it safe to let bernard add code to my site?). You see it in your draft, the summary of the change says what it talks to, and you publish it like any other change. See Can I run my own code on my site?.

And something that is not code at all

Accordions, tabs, a menu that opens on tap, a panel that shows when you click: much of what people call “interactive” needs no program at all, just the right markup. bernard reaches for that first, because it works on every device, with no loading, and cannot break.

Why the rule exists

A website that will run whatever it is handed is a website that gets broken into, and the damage lands on your visitors rather than on you. Keeping everything that runs inside a small tested set, or behind bernard’s checks, is what lets bernard promise your site is safe and actually mean it. The cost is that a script pasted into a page is always removed. The benefit is that no code reaches your site without passing bernard’s checks, and none of it reaches your visitors until you publish.

Ask for the outcome, not the method. You will usually get it, and when you cannot, you will be told why and the request will go to the people who can add it.

If your site needs code of its own, such as a calculator built for your business, see Can I run my own code on my site? for how bernard checks it.

Questions people ask

Can bernard write a small script for me?
A script typed straight into a page is always removed. If your site needs code of its own, such as a calculator, your assistant can add it the checked way: bernard checks the code before it goes into your draft, and it reaches your visitors only when you approve the change by publishing. This works on every bernard account, and so do the animations from bernard’s library. See Run your own code on your site.
Why did my slider stop working after the move?
Your old site ran its own code to move the slides. bernard keeps a site’s own code when the move captured it and it does not make the page slower or add errors; otherwise it is removed and listed in the import record. Where it was removed, bernard puts its own carousel in its place, so the slides move again. If one on your site is still stuck, ask and it gets wired up.
Can I add my payment provider’s button?
A Stripe Buy Button works today: it counts as strictly necessary, so it loads straight away with no cookie banner. A PayPal button is checked and waiting on a technical fix. Ask and bernard will tell you when it is ready.
How do I ask for something new?
Describe what you want the page to do, in your own words. If there is a way today, bernard does it. If there is not, it files the request with the people who build bernard and tells you plainly that it has.
Does my analytics still work?
Yes. Analytics, advertising and chat tags are added a different way, from bernard’s side rather than into the page, and they only run for visitors who agree to cookies.

Next