You clever people on here might tell me reasons why this coding is no good, but since posting this question, I have now found that the following worked for an ancient small Android tablet, iPhones 6s & 11 and ipads 6th generation and 8th generation, a desktop computer and a touch-enabled laptop. That's now exhausted the technology in my house!
Placed in the head section:
<link rel="alternate" href="https://mywebsite.com/index.html" id="desktop"
media="only screen and (touch-enabled: 0)">
<link rel="alternate" href="https://mywebsite.com/page2.html " id="phone"
media="only screen and (max-device-width: 640px)">
<link rel="alternate" href="https://mywebsite.com/page3.html" id="tablet"
media="only screen and (min-device-width: 641px)">
<!-- Viewport is very important, since it affects results of media
query matching. -->
<meta name="viewport" content="width=device-width">
<!-- Place the JS in the head to load as little of the page as
possible before (potentially) redirecting. -->
<script src="js/device.js"></script>
And then I loaded the file device.js into the js folder. I got that from https://github.com/borismus/device.js/tree/master/build