Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    PWA: downloading a custom file

    SmartClient Version: v13.1p_2024-12-01/AllModules Development Only (built 2024-12-01)

    Hello, it seems that on iOS, where I have my application installed with "Add to homescreen", if I download a custom PDF file using this code:

    Code:
    myDS.exportData(
                   criteria,
                    {
                        exportDisplay: "download",
                        exportAs: "custom"
                    }
                );
    server side I've got:
    Code:
    rpcManager.doCustomResponse();
                RequestContext.setNoCacheHeaders(response); 
    
                String contentType =  "application/pdf";
                response.setContentType(contentType);
                response.addHeader("content-disposition", "attachment; filename=" + filename);
    it is opened in the PWA window, so after visualizing it I can't go back.

    Is it expected behaviour?

    #2
    Just to clarify, if you try the same thing directly in iOS Safari, do you get the PDF in another browser "tab"?

    Assuming that does happen, what are you hoping for with the PWA? PWAs in iOS don't support multiple browser "tabs". So the best thing that could be done would be for Safari to open to show the PDF.

    If that's what you're hoping for, ChatGPT has some concepts for how that could be done:

    https://chatgpt.com/share/674cdf2b-1...0-98037db2e3a6

    We're not sure whether these actually work, but we'd recommend just making a static PDF available on the server where the PWA is hosted, so that you can try out various techniques with a simple static PDF. If you can get that situation to open Safari, then we can help you apply the same technique to a SmartClient export.

    Comment


      #3
      Originally posted by Isomorphic View Post
      Just to clarify, if you try the same thing directly in iOS Safari, do you get the PDF in another browser "tab"?
      Hmm, no, actually the behavior is the same as in the PWA case.

      Originally posted by Isomorphic View Post
      Assuming that does happen, what are you hoping for with the PWA? PWAs in iOS don't support multiple browser "tabs". So the best thing that could be done would be for Safari to open to show the PDF.

      If that's what you're hoping for, ChatGPT has some concepts for how that could be done:

      https://chatgpt.com/share/674cdf2b-1...0-98037db2e3a6

      We're not sure whether these actually work, but we'd recommend just making a static PDF available on the server where the PWA is hosted, so that you can try out various techniques with a simple static PDF. If you can get that situation to open Safari, then we can help you apply the same technique to a SmartClient export.
      Alright, I'll try the suggested techniques. Thanks for now!

      Comment


        #4
        Hmm, the fact that this happens in Safari too is weird. What happens with the Showcase samples for you? They should be popping another browser "tab".

        Comment


          #5
          Hmm, you're right, the showcase sample https://www-demos.smartclient.com/sm...CustomResponse has a different behaviour, it prompts me to show or download the file.
          But actually it happens also in my application if I download an xlsx.
          Instead if I try to open a PDF, it shows directly in the same browser tab.

          Comment


            #6
            OK, sorry, could you matrix out the cases and behaviors you're seeing - for example, when you talk about what happens in the Showcase, is that in plain iOS Safari, or did you add the Showcase as a homescreen app and test like that? The latter would be the most interesting case, especially if it differs from plain iOS Safari.

            Comment


              #7
              Hello, this is https://www-demos.smartclient.com/sm...CustomResponse in plain Safari: it prompts to Show or Download the file, show will open the file in the same browser "tab".

              Click image for larger version

Name:	IMG_5097.PNG
Views:	16
Size:	191.4 KB
ID:	274261

              Download will actually download the file:

              Click image for larger version

Name:	IMG_5100.PNG
Views:	14
Size:	913.2 KB
ID:	274262

              With the showcase added as a homescreen app, this is what I see:

              Click image for larger version

Name:	IMG_5098.PNG
Views:	14
Size:	145.0 KB
ID:	274263

              tapping the left arrow in the bottom left corner will return to the app, apparently without reloading the application.

              Then If I try https://www-demos.smartclient.com/sm...id=FSpdfExport, with plain Safari it will open in the same browser tab, so with the back button it will reload the app.

              With the showcase added as a homescreen app, I got this nice behaviour:

              Click image for larger version

Name:	IMG_5099.PNG
Views:	13
Size:	411.2 KB
ID:	274264

              where I can return to the app with the back button.
              Unfortunately in my application, added as a homescreen app, I get only the PDF and no controls, so I'm stuck in it and I must close and reopen the application.
              Attached Files

              Comment

              Working...
              X