How do I count html class elements on other page using js

I have a static portfolio website without database, I want to count no. of products on one page and display it on another one .

Right now I have come up with this

<script>
    const elements = document.querySelectorAll('.product');
    const count = elements.length;
    document.getElementById("Count_exec_chair").innerHTML = count;
</script>

But This only works within same page . I want to count products on 3 different pages and display them on 4th one.