I'm using this code in a php conditional if/else statement to open a new window.
echo("<script type=\"text/javascript\">
<!--
window.open(\"http://www.example.com/index.php?$var\");
//-->
</script>
");
It's opening 2 windows instead of one, but only on my live site (on a dedicated server) and not on the test site (shared server).
EDIT: From zebediah49's suggestion, I appended a random int variable after the new window url. It changes the variable with each new window instance, so I assume that means that it runs the conditional twice. I probably should mention that it's using Joomla and a 3rd-party community app, JomSocial.
Alright, as I was editing this and after ~5min of the same window being open, it opened a brand new instance of the window.open window. So obviously it automatically refreshes once as soon as it lands. I'll have to pry into that. Still any suggestions are welcome.
Thank you for your tips regarding language and best practices.