JavaScript - Adv. Redirect Needed
Theres several redirects probably required, but if it could be 1 script that I could put one 1 html page, that would be amazing (if it is possible).
I need the site to: 1. Upon going to site, determine if it is a mobile browser. If so, send visitors to mobile site automatically. If not then continue to step 2. 2. Verify that users can view Flash. If yes check connection speed: A. Send above 60kbits/sec to flash site B. If less send users to html site. If they cannot view Flash, head to step 3 3. For those users that are left, (they can't view flash, and are not using a phone), send them to the html site. I have bolded the 3 versions of the site I have. Please include all code needed, as Im a noob at Javascript programming (explanations on what the lines do would be nice). Thanks Chris Not having a good day...plz help make it WAY better..... Similar TutorialsOkay, Im hoping people good with Javascript read this because I need help! Theres several redirectes required, but if it could be 1 script that I could put one 1 html page, that would be amazing (if it is possible). I need the site to: 1. Upon going to site, determine if it is a mobile browser. If so, send visitors to mobile site automatically. If not then contninue to step 2. 2. Verify that users can view Flash. If yes check connection speed: A. Send above 60kbits/sec to flash site B. If less send users to html site. 3. For those users that are left, (they can't view flash, and are not using a phone), send them to the html site. I have bolded the 3 version of the site I have. Please include all code needed, as Im a noob at Javascript programming (explanations on what the lines do would be nice). Thanks Chris hey guys. i need a js code that redirects to a flash page or to a non flash page after detecting the browsers plugin abilities and if it has flash or not. any help would be appriciated. cheers Hi, I'm trying to change a piece of code I found in a scipt: Code: if (errors == null) { jQuery('#requestform') .hide() .html('<div class="thankyou"><h1>Merci</h1><p>Nous reviendrons vers vous.</p></div>') .show(); } Instead of the .html () I would like to redirect to another webpage of my website, in the same window. Anyone can help me? Thanks. what wrong, it just adds the website to the end of the address bar, and it doesnt redirect???help please <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <div> <h1>hello</h1> <form onsubmit="return go();"> <select name="website" id="website"> <option value="http://www.google.com/">google.com</option> <option value="www.yahoo.com">yahoo.com</option> </select> <script type="text/javascript"> function go() { var s = getElementById("website"); window.location = s.options[s.selectedIndex].value; return false; //prevents the form from being submitted to the server. } </script> <input type="submit"> </form> </div> </body> </html> Hey all im new to the forum as i have just started playing round with javascript but anyway i have this code PHP Code: setTimeout(top.location='profilec.php?id=' + id,4000); and when executed the time delay is not taken into account at all and completly ignored. If i remove the id var from the code and just have PHP Code: setTimeout(top.location='profilec.php?id=',4000); its fine can anyone tell me why this is happening and if there is a solution :-) thanks before hand mike i'm a total noob with java and can't seem to figure this out. i want to add a bit on to the current url : this is the code i'm using , it just keeps adding... Code: window.location=(window.location+"?p=62"); am i even doing this right.. any help appreciated.. Hi, I'm trying to redirect my users to their profile, but can't figure out how to put the function into the link. sethighlightedValue(); is a function that returns the users username. Is there anyway else to do this? Here's what I got: Code: case RETURN: window.location = "profile.php?user='setHighlightedValue();'"; this.setHighlightedValue(); bubble = false; break; I'm trying to figure out how to use an javascript function to redirect without using <body onload>. Normally I use this: Code: <META HTTP-EQUIV="Refresh" Content="0; URL=ajax.php?page=mypage"> But since I'm using ajax, and only want to redirect tha ajax part, the above can not be used... When I have a hyperlink to go to a page in ajax it looks like this: Code: <a href="#" onclick="load('ajax.php?page=mypage','contentarea');return false;"> Is there anyway that I can have the ajax part set into the META HTTP-EQUIV="Refresh" or is there an other way to do this? Thanks in advance... I need a weird browser redirect. I need a text box, we will call it variable "A", and a submit button on a form. when the person types in a number such as 51225 into the text box and clicks submit it will redirect them to the page yourdomain.com/51225.php. What is the best way in doing this? Code: <html> <head> <script type="text/JavaScript"> <!-- A=document.form.ID.value function onclick(event) { window.location = http://yourdomain.com/document.write(A).php" } //--> </script> </head> <body> <form name="form"> ID: <input type="text" name="ID" size="6" value=""> <input type="submit"> </form> </body> </html> I know this is not correct but it is a start. I can't figure out how to place the variable into the url. Hello everyone... I have Javascript code here which gives the time (hours, minutes, seconds) and date (year, month, day), and it updates every second. What I want to do is redirect to a certain page every 10 minutes, on the 10th, 20th, 30th, 40th, 50th and 60th minutes. The time displays and updates every second, but no redirect happens. Please fix my code! Thanks in advance. Code: <tr><td align="center"> <SPAN ID="clock"><?php echo date('d/m/Y <\b\r> H:i:s', time()); ?></SPAN> </td></tr> <SCRIPT type="text/javascript"> var year2 = <?php echo date('Y', time()); ?>; var month2 = <?php echo date('m', time()); ?>; var day2 = <?php echo date('d', time()); ?>; var hour2 = <?php echo date('H', time()); ?>; var minute2 = <?php echo date('i', time()); ?>; var second2 = <?php echo date('s', time()); ?>; var daysInMonth = <?php echo date('t', time()); ?>; function updateClock() { second2+=1; if(second2>=60){second2=0;minute2+=1;} if(minute2>=60){minute2=0;hour2+=1;} if(hour2>=24){hour2=0;day2+=1;} if(day2>daysInMonth){day2=0;month2+=1;} if(month2>12){month2=0;year2+=1;} byt(nollor(day2)+"/"+nollor(month2)+"/"+year2+"<br />"+nollor(hour2)+":"+nollor(minute2)+":"+nollor(second2),"clock"); updateUtlogg(); redirect(minute2,second2); } var utloggUtloggad = false; function updateUtlogg() { if(utloggUtloggad) { return true; } return(true); } function nollor(nummer) { if(nummer<10) { tmp="0"+nummer; } else { tmp=nummer; } return tmp; } function byt(txt,lager) { if(document.getElementById(lager)) { document.getElementById(lager).innerHTML=txt; } } function redirect(x,y) { if(nollor(x)==0 && nollor(y)==0 || nollor(x)==10 && nollor(y)==0 || nollor(x)==20 && nollor(y)==0 || nollor(x)==30 && nollor(y)==0 || nollor(x)==40 && nollor(y)==0 || nollor(x)==50 && nollor(y)==0) { setTimeout("location.href = updateInterval.php;",0); } } var oInterval = window.setInterval("updateClock()",1000); </SCRIPT> Hi I have several checkboxes in a switch statement like the one below: Code: function whatsChecked(obj) { var indx = obj.id.substring(obj.id.length-1, obj.id.length); switch ( indx ) { case '9': if (document.sport.soccer_9.checked) { //window.open.href = "../google.com";; window.open("../google.com"); } break; } } how can I use a continue button to determine which checkbox was clicked and redirect me to the correct page? Hello, I am new on forum and javascript. I have got a query for dynamic geo location javascript. I would like to make a page which redirect to another page based on user REGION. Ex. If user from EMEA then page1.html, if user from APAC then page2.html, if user from Other region then page3.html Hope someone will share their ideas with an example to achive this. Thanks Hi, I have a form in which i have a dropdown list and a submit button. I want to code so that when users select the value from the dropdown list, it should redirect then to the specified page. For instance i have the value, "car", "House" and "pets" in my dropdown listbox, if a use click on "car" it should redirect them to the car page. I have done the following code, but something seems not to work Code: <script type="text/javascript"> function move(){ if (document.sell.cat.value == 'Cars'){ window.location = 'http://www.yourdomain.com' } </script> and in the submit button am calling the function move() Code: <input type="submit" name="button2" id="button2" value="Search" onclick="move()"/> my form name is sell and the dropdown list menu is cat. Thanks Hello everybody, What I have been trying to incorporate into my site is that if a user has javascript turned off, it redirects them to another page. This is what I have found but doesn't seem to work. Code: <NOSCRIPT> <meta http-equiv=”refresh” content=”0; URL=AlternatePage.cfm”> </NOSCRIPT> When I test it out it shows on the page like this: meta http-equiv=”refresh” content=”0; URL=AlternatePage.cfm” Basically shows the same thing without the tags. It doesn't take any action at all. Any ideas, tips, or advice? I don't have any access to the root directory so SSI is not an option at the moment. (Do plan of hosting it on a dedicated server when I have the money ) I want to be able to put up files and assign passwords to individuals so that they can access one of those files but not all. In other words person A enters password & is redirected to file A; person B enters password & is redirected to file B, etc. Anyone have an example or know where I can get an example of a script like this? I am not a programmer so the simplier the better. Thanks
Hi guys, I have this script to print a page, which it does fine. However, after the script runs, the browser redirects to the folder root: Code: <SCRIPT Language="Javascript"> //PRINT PAGE FUNCTION function printit(){ if (window.print) { window.print() ; } else { var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>'; document.body.insertAdjacentHTML('beforeEnd', WebBrowser); WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = ""; } } </script> How can I stop this happening? I want remain on the current page! Hello All, I have some javscript running on a page to automatically redirect the user to the SSL secured page (https). The code I have works fine when there is www. in front of the site name, but if you just type the site name without the url the code doesn't work. Any suggestions? Thank so much. Code: <script language="javascript" type="text/javascript" > // This is the hostname that will trigger enforcement of redirection. var enableRedirect = true; // This is the hostname that will trigger enforcement of redirection. var externalHostname = "www.exelonenergy.com"; // This is the reconstructed URL if the current URL contains the externalHostname: var redirectURL = "https://" + externalHostname + window.location.pathname; // If the URL contains the externalHostname specified above, // and the protocol in plain http:, then redirect to the https: equivalent: if (enableRedirect == true) { if (window.location.hostname.indexOf(externalHostname) >= 0) { if (window.location.protocol == "http:") { window.location.href = redirectURL; } } } </script> Hi, I want to do a redirect count so that the user can see the count going down. for example, I want them to be able to see the following. You will be redirected in 5 seconds. The user should be able to see the count going down from 5 to 4 to 3 to 2 to 1 and then they are redirected. I can get the page to redirect after 5 seconds but I want the user to be able to see it count down. Thanks in advance for your help I was wondering how I could redirect from one div to another div after " x " seconds on the same page.. Is this possible? So like basically: Index page: > Shows div1, after x seconds shows div2 etc.. OK, my javascript is not that good. So I need your help! I need to create a text box that will only work if a certain code is entered. So if 1234 is in the text box and submit is clicked, then it will take you to the site. IF not then it will print "Please enter correct code" next to the submit button. Here is what I have so far: <input name="txtBox" type="text"/> <input name="btnButton" type="button" value="Submit" onclick="return checkValue()" /> <script type="text/JavaScript"> function checkValue() { var secretcode = document.getElementById("txtBox"); if (secretcode == "1234") { document.location.href = 'secret.html'; } } </script> Thank you for your help! |