So what you're looking for is called an EventListener this will trigger on certain event such as resizing of the browser window.
Also you may want to look at https://www.w3schools.com/jsref/ as it is a really good resource for beginners.
As for the code to do this :
window.addEventListener("resize", function(){
var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
if (width <= 1440) window.location.replace("example.html");
});
[EDIT]
So working out screen size in Inches is a little more complex, the standard way is to use pixels but if you are set on using In here is a resource that you can use.
So it would be about picking usually 3 breaking points for you code, 3 screen widths.
Popular resolutions are 360x640 (mobile), 768x1024 (tablet) and 1366x768 (desktop).
So you would the end up with something like this:
window.addEventListener("resize", function(){
var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var currentPage = window.location.origin;
if (width <= 420 && !currentPage.includes("mobile")) window.location.replace("mobile.example.html");
else if(width >= 1280 && !currentPage.includes("desktop")) window.location.replace("desktop.example.html");
else if(!currentPage.includes("tablet")) window.location.replace("tablet.example.html");
});
The currentPage.includes("tablet")
is to stop a redirect loop once you're on the correct page.