Hiển thị các bài đăng có nhãn Safari. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn Safari. Hiển thị tất cả bài đăng

Thứ Sáu, 16 tháng 6, 2023

Iphone Safari issue toolbar over at bottom

 

Solutions

#1: IOS 16.4 support above 100svh,lvh,dvh (small,large,dynamic view height): old version not supoport
#2: Padding 105px: always have space at bottom
#3: Script view check screen view height: SOLVED this is the best way. This solution reuse idea

https://viblo.asia/p/sua-loi-100vh-tren-thiet-bi-ios-safari-gGJ59GEjZX2

jQuery(document).ready(function(){

const windowHeight = () => {
        var svh = window.innerHeight;
        console.log(svh);
        /*set*/       
        jQuery('#i_display_container_fixed').css('height',svh+'px');
    }
    window.addEventListener('resize', windowHeight);
    windowHeight();

});

Thứ Ba, 26 tháng 11, 2013

SAFARI iframe session issue

Trình duyệt SAFARI không cho load session của IFRAME.
Nguyên nhân: trình duyệt safari chống các tự động popup.
Ảnh hưởng: đây là suy nghĩ tốt của SAFARI nhưng ảnh hưởng đối với website load iframe có sử dụng cần session.
Mục tiêu cần đạt được: Mở được session của host (là link IFRAME).
Muốn mở được session sẽ gặp trở ngại CROSS Browser Session. Theo nguyên tắc bảo mật thì host nào được mở session ở host đó. Không có quyền mở session ở host khác.
Vì vậy: cần phải có quyền truy cập ở cả 2 host. Hoặc 1 số website như facebook có hỗ trợ mở session. (cái này tìm hiểu facebook nhé).

Ví dụ đây: file index.php có chứa iframe
<iframe  id="blockrandom" name="contentframe" src="http://example_target.com" width="100%" height="1850"/>

Cách xử lý 1: Dùng trình duyệt safari mở 1 example_target.com, sau đó load file có chưa iframe. Thì mọi việc sẽ chạy bình thường. Nguyên nhân là session đã mở ít nhất 1 lần, sau đó safari sẽ tự nhận. BAD

Cách xử lý 2: Dùng trình duyệt safari viết thêm vào file index.php để tự động mở 1 new tab hoặc new window. Cách này suy nghĩ thì đúng nhưng ko làm được mặc dù nguyên lý gần giống cách 1 là mở example_target.com, nguyên nhân Safari chặn ko cho tự động popup.SO BAD

Cách xử lý 3: Redirect trực tiếp. GOOD
HOST 1: file index.php kiểm tra là browser safari thì redirect đến HOST 2 và open session.
HOST 2: open session: tạo mới file InitSession.php thì phải dùng PHP để open, sau khi open thì redirect lại HOST 1. (phải làm như vậy thì session mới mở được).
HOST 1 kiểm tra và họat động bình thường.

Chi tiết cách 3:
HOST 1 file index.php
<?php if ( ! count($_COOKIE) > 0 && strpos($_SERVER['HTTP_USER_AGENT'], 'Safari')&& $_GET['session']!='open') { ?>
<script type="text/javascript">
    window.top.location.href = 'http://example_target.com/InitSession.php';
</script>
<?php
}
?>
Start iframe<br/>
<iframe  id="blockrandom" name="contentframe" src="http://example_target.com" width="100%" height="600px"/>
End iframe<br/>

HOST 2 file InitSession.php
<?php
//inside setcookie.php
header('P3P: CP="CAO PSA OUR"');
session_start();
echo
'<script>
top.location = "http://host1.com/index.php?session=open";
</script>';
?>