デバイス振り分け PC・SPで振分け
(function() {
var ua = navigator.userAgent.toUpperCase();
var url = document.location.pathname;
var spDir = 'index_sp.html';
(ua.indexOf('IPHONE') != -1 || (ua.indexOf('ANDROID') != -1 && ua.indexOf('MOBILE') != -1)) ?
isSP():
isPC();
function isSP() {
if (url.match(spDir)) {
return false;
} else {
location.href = spDir;
}
}
function isPC() {
if (!url.match(spDir)) {
return false;
} else {
location.href = '/';
}
}
}());