Your logic here (reformated):
if ((browser=="msie") && (version>=4)) {
if (browser=="opera"||"chrome"||"safari"||"firefox") {
location.replace("mobile_demo.php");
}
else {
location.replace("full_demo.php");
}
}
means
If the browser is "msie" and the version is 4 or greater, then if the browser is "opera", "chrome", "safari", or "firefox" go to the mobile demo, but if it's not one of those four go to the full demo.
So, you check to see if the browser is "msie", and then check to see if it's one of those other four browsers. When will it be? Never, because we only make that test when the browser is already known to be "msie". It can't be "msie" and one of the other ones at the same time, so the code always loads the full demo, unless the browser isn't "msie", in which case it does either nothing at all or something you didn't post.
edit — if all you need to do is determine whether the browser is IE or not:
if (browser == "msie")
location.replace("full_demo.php");
else
location.replace("mobile_demo.php");
For IE11, however, you're going to run into the problem that Microsoft has deliberately taken "MSIE" out of the useragent string. To deal with that, you could change the regex so that it matches the "Trident" string, I guess. See this MSDN resource for more details.