본문으로 건너뛰기

최신 iOS Safari 환경 네이버페이(주문형) 이동 안정성 개선

PHP 8 · GODO26
변경 파일 수: 1개
변경 파일 목록
총 1개
변경 파일 코드
추가삭제
Controller/Front/Goods/NaverPayController.php+11-12
변경 전NaverPayController.php
?>
<html>
<body>
<form name="frm" method="get" action="<?= $redirectUrl ?>">
</form>
</body>
<?php echo $fbScript; ?>
<script>
<?php if(\Request::isMobileDevice()){ ?>
<?php if($naverPayConfig['mobileButtonTarget'] == 'new') {?>
document.frm.target = "_blank";
<?php }
else {?>
document.frm.target = "_top";
<?php }?>
document.frm.submit();
<?php }else{ ?>
document.frm.submit();
 
<?php } ?>
window.onpageshow = function(event) {
/**
 
변경 후NaverPayController.php
?>
<html>
<body>
 
 
</body>
<?php echo $fbScript; ?>
<script>
/**
* iOS Safari ITP 대응: 폼 자동 submit 대신 location.replace로 최상위 이동
* (최상위 내비게이션은 ITP 차단 대상이 아니라 이동 끊김이 줄어듬)
* 페이스북 픽셀($fbScript)은 측정 유지를 위해 이동 직전에 먼저 출력
*/
<?php if (\Request::isMobileDevice() && $naverPayConfig['mobileButtonTarget'] === 'new') { ?>
window.open("<?= $redirectUrl ?>"); // 모바일 '새 창' 설정
<?php } elseif (\Request::isMobileDevice()) { ?>
window.top.location.replace("<?= $redirectUrl ?>"); // 모바일 _top 이동
<?php } else { ?>
location.replace("<?= $redirectUrl ?>"); // PC 현재 창 이동
<?php } ?>
window.onpageshow = function(event) {
/**