티스토리 뷰

Programing

모바일 홈페이지 URL 포워딩

애플자라 2016. 10. 18. 16:22
반응형

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, minimum-scale=1.0, user-scalable=yes, target-densitydpi=medium-dpi">

<title>타이틀</title>

<style type="text/css">

.viewer { width:100%; margin:0 auto; }

.viewer img { max-width:100%; }

table { width:100%; margin:auto; text-align:center;}

</style>


<script type="text/javascript">


var mobileInfo = new Array('Android', 'iPhone', 'iPod', 'BlackBerry', 'Windows CE', 'SAMSUNG', 'LG', 'MOT', 'SonyEricsson');

for (var info in mobileInfo){

    if (navigator.userAgent.match(mobileInfo[info]) != null){

    

     //로그추가코드 START

(function(){

 var http_us = "http://모바일URL/main.do"; //이동URL

 var http_param = [];

 var str_param = "";

 if(document.location.search != ""){

  http_param.push(document.location.search.replace(/^\?/, ""));

 }

 if(document.referrer != ""  && !/OV_REFFER/.test(document.location.search)){

 http_param.push("OV_REFFER="+document.referrer);

 }

 if(http_param.length > 0){

  str_param = (/\?/.test(http_us) ? "&" : "?")+http_param.join("&");

 }else{

  str_param = "";

 }

 location.href =http_us+str_param;

})();

//로그추가코드 END

     //location.href = 'https://모바일URL/main.do';

        break;

    }

}


/*

if ( document.body.clientWidth < 800 ) {

location.href = 'https://모바일URL/main.do';

}

*/


var myWidth = 0, myHeight = 0;

if( typeof( window.innerWidth ) == 'number' ) {

  //Non-IE

  myWidth = window.innerWidth;

  myHeight = window.innerHeight;

} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {

  //IE 6+ in 'standards compliant mode'

  myWidth = document.documentElement.clientWidth;

  myHeight = document.documentElement.clientHeight;

} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {

  //IE 4 compatible

  myWidth = document.body.clientWidth;

  myHeight = document.body.clientHeight;

}


if ( myWidth < 800 ){

//로그추가코드 START

(function(){

 var http_us = "http://모바일URL/main.do"; //이동URL

 var http_param = [];

 var str_param = "";

 if(document.location.search != ""){

  http_param.push(document.location.search.replace(/^\?/, ""));

 }

 if(document.referrer != ""  && !/OV_REFFER/.test(document.location.search)){

 http_param.push("OV_REFFER="+document.referrer);

 }

 if(http_param.length > 0){

  str_param = (/\?/.test(http_us) ? "&" : "?")+http_param.join("&");

 }else{

  str_param = "";

 }

 location.href =http_us+str_param;

})();

//로그추가코드 END

//location.href = 'https://모바일URL/main.do';

}

else{

//로그추가코드 START

(function(){

 var http_us = "http://이동URL/main.do"; //이동URL

 var http_param = [];

 var str_param = "";

 if(document.location.search != ""){

  http_param.push(document.location.search.replace(/^\?/, ""));

 }

 if(document.referrer != ""  && !/OV_REFFER/.test(document.location.search)){

 http_param.push("OV_REFFER="+document.referrer);

 }

 if(http_param.length > 0){

  str_param = (/\?/.test(http_us) ? "&" : "?")+http_param.join("&");

 }else{

  str_param = "";

 }

 location.href =http_us+str_param;

})();

//로그추가코드 END

//location.href = 'https://이동URL/main.do';

}


//location.href = 'https://이동URL/main.do';


</script>


반응형
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함