Posts

Post not yet marked as solved
0 Replies
792 Views
Hello i'm yonghee lee.I would like to inquire about the pageshow event in the Safari browser environment.As an official response from Apple, I followed the guide below.. (Due to the nature of ios, the pageshow event listener was registered and developed for backward motion due to bfcahce.)[offical respone for apple]This is because we now allow pages served with “Cache-Control: no-store” (and served over HTTPS) in the back/forward cache. Because we have a ~100% success rate on the back/forward cache now, when you hit the back button, you will see the same previous page (that we suspended in memory), we will NOT reload it and thus HTTP caching header do not apply.Developers can listen to the “pageshow” event that is dispatched on the window and check “event.persisted” to know that they were restored from the back/forward cache.If there is an iframe element, the pageshow event occurs only once and then does not occur.Is there any alternative to this phenomenon other than pageshow?Thank you.STEPS TO REPRODUCE<!DOCTYPE html><html lang="ko"> ><head> > <title>test</title> > <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"> ></head> ><body> > ><iframe style="width:100%;height:50px"></iframe><ul id="result" style="border:#000000 solid 1px;"></ul> ><script type="text/javascript"> var ul = document.querySelector("#result"); function trace(str) { var li = document.createElement('li'); li.innerHTML = str; ul.appendChild(li); } window.addEventListener('pageshow', e => { trace('e.persisted: ' + e.persisted); });</script></body></html>1. go outside current page2. histroy back3. check li element(trace)4. go outside current page5. history back6. check event persisted property7. check `occur only once ( trace)`thank you
Posted Last updated
.