I have a website that I want to redirect on a particular page for mobile users, so the following is currently in the header of the relevant page
<script type="text/javascript">
if (screen.width<640) {
window.location="mobilePage";
}
</script>
If I click from the main navigation, this does nothing. However, I refresh the page, it works. Part of the trouble is that I've used a website builder, on account of not being any good at graphic design and not wanting to have to keep up with new phones / versions of things. That means a lot of code is hidden from me, which makes it phenomenally harder to debug. I've tried forcing it to reload once, but no dice.
Does anyone have any insight as to why this is happening, and more importantly if there's anything I can do? It would be much appreciated!
(PS Not sure if the website is helpful to elucidate my struggle, but the page in question is here.)