4 Replies
      Latest reply on Jun 19, 2019 2:36 AM by eskimo
      imsmooth Level 1 Level 1 (0 points)

        Is there a swift command/function that allows me to erase the iphone browser history or elements within that history?

        • Re: erasing iPhone browser history
          eskimo Apple Staff Apple Staff (11,835 points)

          Is there a swift command/function that allows me to erase the iphone browser history or elements within that history?

          I presume you’re specifically refer to the browser history maintained by Safari, in which case the answer is “No.”

          Can you elaborate more on what you app does?  Depending on your situation, you may be able to accomplish your goal using WKWebView.  Or it’s possible that your only option would be to file an enhancement request for a new API.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

            • Re: erasing iPhone browser history
              imsmooth Level 1 Level 1 (0 points)

              I am looking at an app right now that does this. A user goes to a website (site 1) and the app changes the page (to site 2) the person is viewing on that website. Then, it changes the history of the web address so it only appears the person went to site 2 if he goes to the viewing history.

                • Re: erasing iPhone browser history
                  eskimo Apple Staff Apple Staff (11,835 points)

                  JavaScript running in a web view has access to the web view’s history via the window.history property.  There are, however, significant limitations here:

                  • You won’t see Safari history in a WKWebView (or the legacy UIWebView).

                  • I’m not sure where you’ll see Safari history in an SFSafariViewController [1] but, even if you do, you can’t explicitly run JavaScript in that view.

                  Share and Enjoy

                  Quinn “The Eskimo!”
                  Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                  let myEmail = "eskimo" + "1" + "@apple.com"

                  [1] It used to be the case that SFSafariViewController was Just Like Safari™, but we’ve added more restrictions recently.

              • Re: erasing iPhone browser history
                Claude31 Level 8 Level 8 (6,515 points)

                Hi, that seems to be a duplicate from what you posted in getting started. Should remove the other one.