javascript - If Else Conditions Redirect -


I want to redirect to the country

After finding the country, I should know That user from mobile

and then

  jQuery.getJSON ('http://freegeoip.net/json/', function (location) {if (location.country_code = = 'PH' || location.country_code == 'IN') {top.location.href = 'xxxxxxxxxxx';} if (/ Android | webOS | iPhone | iPad | iPod | BlackBerry | Aiimobi | Opera Mini / I. Test (Navigator. EagerEngent)) {} other {top.location.href = 'xxxxxxxxxxxxx';}}};   

This work

try it,

  $ (function ( ) {jQuery.getJSON ( 'http://freegeoip.net/json/', function (position) {if (location.country_code == 'PH' || location Country_code == 'IN') {if (/ Android | webOS | iPhone | iPad | iPod | BlackBerry | Aiimobi | Opera Mini / Aitest (Navigator. The user agent is)) {top.location.href = 'xxxxxxxxxxxxx? Type = mobile '; // mobile} other {top.location.href = 'xxxxxxxxxxxxx? Type = desktop '; // desktop}} and {top.location.href = 'xxxxxxxxxxx'; // Other Countries}})}};    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -