0

On my iPad/iPhone, I have been searching for a solution for viewing text files from websites that do not offer a .txt extension when clicking to view a document. A filename is provided, but without any extension. Safari will download the file but not view the file. Saving the file to downloads and attempting to open in Files app doesn't work, because Files app won't let me rename the D/L to add a .txt extension / file type.

Up until today, my workaround was to copy the downloaded file from Files to the DropBox app, which does let me rename the file and view it. Unfortunately, it's a lot of extra steps, which take an excessive amount of time to complete. And I have to do this a lot. :-(

Today, I managed to make a Shortcut that lets me view the file after downloading. It is still an imperfect solution. I'd like some help with the following two desired behaviors / enhancements.

  1. I would like the Shortcut to be a top-level choice in the Files app actions. So far I have only been able to add the shortcut to the Share menu, so it's an extra step to access. I did already set the "Show in Share Sheet" and "Use As Quick Action" but the latter is under a "Mac" heading, which I take to mean won't be applicable on iPad.

  2. I would like to be able to long-press on the link and have the shortcut view the contents of the file, directly, without having to download and switch to the Files app. I can invoke my Shortcut from Safari, but it doesn't show the contents of the (untyped) text file, it just shows the download URL. Perhaps I need an altogether different Shortcut for this use case?

Here is the shortcut:

[View as Text Shortcut] (https://www.icloud.com/shortcuts/164de95d38eb41e5945411bf50473427)

Screenshot: View as Text Shortcut (Screenshot)

For the input types, I chose, the following:

  • Files
  • Text
  • Rich Text
  • Safari web pages
  • URLs

Anyone have a solution to the above two "enhancements" or a better overall solution? Thanks in advance.

1
  • Unfortunately, #1 is simply not possible—Apple has not provided a mechanism for acting on objects with another third-party app (and user Shortcuts are treated, at best, like third-party apps) aside from the Share sheet. (I assume you’ve seen you can do Share… and then scroll to the very bottom, where Edit Actions… will let you select your shortcut directly—so that skips one tap, but probably adds a scroll, so generally works out as a wash.) As you noted, Quick Actions are a strictly-macOS feature.
    – Trey
    Commented Jul 14, 2022 at 15:02

2 Answers 2

1

This is a vexing issue—switching from a Mac to an iPad Pro as my workhorse machine, I’ve found you can do nearly anything, but streamlining the workflow to get there, as you can on macOS (which, being an open Unix, is generally malleable, unlike the locked-sandbox iOS/iPadOS) is often just not possible.

First, the good news: a near-future (as of this writing, 14 Jul 2022; I’ll make a note to edit this later) iPadOS ≥ 16 fix is coming: changing file extensions directly in the Files app. That should mean that the “Save File” action in Safari should let you change the extension as well as it currently allows you to change the base filename by tapping on it—though I don’t have the iPadOS 16 preview, so can’t say for sure.

In the meantime, I suspect a Safari extension (which are now available on iPad, though the number actually on the App Store is still quite small even over a year after the feature debuted) could do this, but I’m not sure.

(I don’t have a background in browser request handling so glancing at the documentation I can’t even see where to start. If you do know your way around JavaScript browser code, the Xcode documentation may make more sense to you—it seems like they’ve used the same nomenclature for framework APIs. There are tutorials that make writing iOS/iPadOS Safari extensions seem fairly straightforward if you know your way around Xcode. But unless you’re very familiar with Xcode and browser request handling, it’s probably easier to just wait for iOS/iPadOS 16.)

0

Made an attempt at enhancement #2, but unfortunately each variation of reading a webpage via the Safari action or the Get Contents of URL action runs outside the context of Safari, which means the retrieval lacks my session state + cookies. I even supplied my credentials, but ultimately the site returns a sorry page, "The link you followed has expired."

Here is my attempt: View URL as Text

Screenshot: View URL as Text (Screenshot)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .