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
Post a Comment