I have two `simple` javascript what I wanna combine between detecting in two different browsers to script to another page.
- Edge browser scipping to an page were I can use unlimited speech engine.
- Chrome browser scips to another basic page couse huge limits in speech engine.
I do not known mutch from javascripts, thought to solve this easely `but no`
How can I make it work ?
The timer is right, also the browser-detection works propper.
Code: Select all
location.href="index-normal.php"
Code: Select all
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var start=new Date();
start=Date.parse(start)/1000;
var counts1=4;
function CountDown1(){
var now=new Date();
now=Date.parse(now)/1000;
var x=parseInt(counts1-(now-start),10);
if(document.form1){document.form1.clock1.value = x;}
if(x>0){
timerID=setTimeout("CountDown1()", 1000)
}else{
location.href="index-talk.php"
}
}
// End -->
</script>
Code: Select all
<SCRIPT LANGUAGE="JavaScript">
<!--
window.setTimeout('CountDown1()',400);
-->
</script>
Code: Select all
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var start=new Date();
start=Date.parse(start)/1000;
var counts=4;
function CountDown(){
var now=new Date();
now=Date.parse(now)/1000;
var x=parseInt(counts-(now-start),10);
if(document.form2){document.form2.clock2.value = x;}
if(x>0){
timerID=setTimeout("CountDown()", 100)
}else{
location.href="index-normal.php"
}
}
// End -->
</script>
Code: Select all
<SCRIPT LANGUAGE="JavaScript">
<!--
window.setTimeout('CountDown()',400);
-->
</script>
Code: Select all
<!doctype html>
<html>
<head>
<title>Test demo</title>
</head>
<body>
<script>
var browser = (function (agent) {
switch (true) {
case agent.indexOf("edg") > -1: return "<FORM NAME='form1'><p align='center'>You will redericted in Edge <INPUT TYPE='text' NAME='clock1' SIZE='2' VALUE='4'> seconden. edge </FORM> edge ";
case agent.indexOf("chrome") > -1 && !!window.chrome: return "<FORM NAME='form2'><p align='center'>You will redericted in chrome <INPUT TYPE='text' NAME='clock2' SIZE='2' VALUE='10'> seconden. chrome </FORM> chrome";
default: return "other";
}
})(window.navigator.userAgent.toLowerCase());
document.body.innerHTML = " " + browser + " browser." + "<br>ok<br>";
</script>
</body>
</html>