Hacker News new | ask | show | jobs
by walterbell 2822 days ago
iOS12 Shortcuts are a limited form of extension, they can parse JS from a web page and cause side effects. E.g.

- extract URL and download youtube video to camera roll

- move a running video out of browser into picture-in-picture mode for multitasking

Content (ad) blocking extensions are supported in Safari.

1 comments

Shortcuts can "parse JS from a web page"? Can you explain how that's possible? None of the examples you listed seem to involve direct access to page content.
Here's the JS for PiP video, the shortcut command is "Run JS in web page":

  var videos = document.getElementsByTagName("video");
  if (videos) {
    var video = videos[0];
        video.webkitSetPresentationMode(video.webkitPresentationMode === "picture-in-picture" ? "inline" : "picture-in-picture");
  }

  completion({"success": true});