How to detect iPad/Tablet device and redirect to a different page?

Hello out there. I am somewhat new to javascript, and would like to know…
Is there is a code that can detect the width of a device being used (but ONLY for iPads/Tablets/Laptops - NOT Mobile phones) and then redirect to a different page instead?

I am having a lot of difficulty making my Desktop website appear responsive, specifically on an iPad/Tablet or even Laptop. (My Mobile version website is ok for Mobile phones.)

I thought of duplicating a Desktop page, renaming it, and then adjusting it so it will look better when viewed on an iPad/Tablet/Laptop… but how can I get those devices to recognize the re-designed page instead of the original Desktop page?

For instance, is there a script function something like this that will detect the device being used:
if iPad/Tablet device WindowWidth (at certain pixel range)
then perform this script to redirect to “/doubletake-B”

			if  **Laptop**  device  **WindowWidth** (at certain pixel range)  
			then perform this script to redirect to "/doubletake-B" 

The names of the pages would be as follows:
Original Page url: “/doubletake-A” (designed for Desktop)
Duplicated Page url: “/doubletake-B” (re-designed for iPad/Tablet/Laptop)

So basically, when an iPad/Tablet/Laptop user clicks the “/doubletake-A” page, they see the “/doubletake-B” page instead.

I hope this make sense. Would GREATLY appreciate any help !! Thank you so much !!

P.S. - Please do not request that I use the new “Editor X” program since they have a separate editor for Tablets. I cannot start over and create a whole new website from scratch just to fix this problem.