1 Reply
      Latest reply: Oct 13, 2016 4:06 AM by eskimo RSS
      Rauf Level 1 Level 1 (0 points)

        How I can open "data:image/gif" in Safari by pressing button??

        Swift 3.0

        For example take this gif image: data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw%0AAAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFz%0AByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSp%0Aa/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJl%0AZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uis%0AF81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PH%0Ahhx4dbgYKAAA7

         

        Please help and explain me how to make it. I am newbie.

        • Re: Open data:image/gif;base64 in Safari
          eskimo Apple Staff Apple Staff (6,065 points)

          The normal way to open a URL in Safari is via UIApplication.open(_:options:completionHandler:) (or the older openURL(_:)).  However, this does not work for data: URLs because Safari doesn’t claim them.

          OTOH, there are other ways to present GIF data, either in a web view (WKWebView) or, unless you need the whole web view, in an image view.  Do you really need to show this in Safari?

          Share and Enjoy

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