There are two options.
If you want to continue using Javascript redirects, then between <head>
and </head>
in your HTML code with javascript redirect code, add:
<link rel="canonical" href="resultingurl">
<meta name="robots" content="noindex">
but replace "resultingurl" with the full URL to the URL javascript redirects the page to.
At least this way, you're pointing out to google that the first page is the duplicate of the new page and you prefer the new page to be indexed. Also, you're specifically telling all search engines not to index the first page. Therefore, no chance of duplication issues.
But if you want to create a better user experience, implement HTTP redirects so that users don't need javascript to view your site. The only advantage to javascript is if you had a wonderful introduction screen you want people to see before visiting the main site.
You can easily use PHP to do this by creating index.php with the following contents:
<?php
$newurl="http://example.com";
header("HTTP/1.1 301 Moved Permanently",true);
header("Location: ".$newurl,true);
?>
Save the file in document root to make the main domain redirect to the new one.
Replace example.com in the code with the new url the first url is supposed to redirect to.
Whatever you do, just make sure the duplicate pages (copies of the same pages with an HTTP 200 status code) are no-indexed.