I'm trying to get links in a iPhone standalone web app to open inside the web app instead of safari.
I have found this thread iPhone Safari Web App opens links in new window which helped me a lot. I have used the answer by rmarscher
<script>(function(a,b,c){if(c in b&&b[c]){var d,e=a.location,f=/^(a|html)$/i;a.addEventListener("click",function(a){d=a.target;while(!f.test(d.nodeName))d=d.parentNode;"href"in d&&(d.href.indexOf("http")||~d.href.indexOf(e.host))&&(a.preventDefault(),e.href=d.href)},!1)}})(document,window.navigator,"standalone")</script>
The problem I'm having is when my app uses a link with javascript:history.go(-1). If I click a link after clicking history.go(-1), it will open in safari instead of the web app.
Can someone please look at the code and see if there is a solution to this problem?