iphoneiosweb-applicationsiphone-web-app

When open an URL in webapp, how to display the new page in it without jump to Safari?


I have two page in one directory for an iOS web app. One is index.html, the other one is detail.html.

In index.html, there is a link to detail.html like this

<a href="detail.html">
Redirect 
</a>

I opened index.html in iPhone's safari, then I added index.html to home screen.Then I opened this web app from home screen. When tapped "Redirect", the web app entered background , then Safari opened detail.html and came to foreground.

How to open detail.html in web app itself and not redirect to safari? Special Thanks!


Solution

  • I found the solution in https://developer.apple.com/library/archive/documentation/AppleApplications/Conceptual/Dashcode_UserGuide/Contents/Resources/en.lproj/MakingaWebApp/MakingaWebApp.html#//apple_ref/doc/uid/TP40004692-CH18

    I finally use javascript instead of label.

    <SCRIPT LANGUAGE="JScript">
    function toDetail() {
        document.location=('detail.html');
    }
    </SCRIPT>
    
    <div class="cell" onclick="toDetail()">
    </div>