In iOS 14, Apple added a Picture in Picture mode on iPhone that lets you watch a video in a small screen on your device while you continue to do other things on the phone.

YouTube Picture in Picture
Picture in Picture mode doesn't work in the YouTube app, although it was possible to watch videos in Picture in Picture on YouTube's mobile website through Safari until YouTube intentionally nixed the workaround last week, presumably to push people to buy a Premium subscription. For a short while, you could still get Picture in Picture to work on YouTube.com in Safari if you request the desktop site, but YouTube has since blocked that as well.

But thanks to CodeEverywhere, there's now another neat workaround that uses a snippet of JavaScript and no external plugins to suppress the Picture in Picture block that YouTube has added to its mobile site.

As noted by CodeEverywhere, the same code can also be used in an iOS Shortcut that can then be selected from Safari's Activity view (formerly called the Share Sheet) whenever you want to watch a YouTube-hosted video in Picture in Picture.

Using CodeEverywhere's script, software engineer Jonas Reitmann has since created a Shortcut and made it available for download (Note: people are having trouble with the direct download shortcut working. Follow the directions below), but if you are uncomfortable downloading a shortcut blindly, you can recreate it with the steps below.

How to Create a Shortcut for YouTube Picture in Picture

  1. Launch the Shortcuts app on your ‌iPhone‌ and click the plus (+) icon in the top-right corner of the screen to create a new shortcut.
    shortcuts

  2. Tap Add Action.
    shortcuts

  3. Select Web.
    shortcuts

  4. Under "Safari," select Run JavaScript on Web Page.
    shortcuts

  5. Where it says "Run JavaScript on" tap the blue words Web Page, then select Shortcut Input in the pop-up menu.
    shortcuts

  6. Remove the existing JavaScript code in the shortcut window and paste in the following code:
    let v = document.querySelector('video');

    v.addEventListener('webkitpresentationmodechanged', (e)=>e.stopPropagation(), true);

    setTimeout(()=>v.webkitSetPresentationMode('picture-in-picture'), 3000);

    completion()
    shortcuts

  7. Tap the three dots icon in the top-right corner of the screen.
    shortcuts

  8. Give your shortcut a name, e.g. "YouTube PiP," then toggle the switch next to Show in Share Sheet to the green ON position.
    shortcuts

  9. Tap Share Sheet Types, then select Deselect All and tap Safari web pages.
    shortcuts

  10. Return to the Details screen, then tap Done.
    shortcuts

  11. Tap Done to finish.
    shortcuts

With that done, simply select the Shortcut in Safari via the Action icon whenever you want to use Picture in Picture on YouTube's mobile website, no premium subscription required.

safari

Related Forum: iOS 14

Popular Stories

iphone 17 models

No iPhone 18 Launch This Year, Reports Suggest

Thursday January 1, 2026 8:43 am PST by
Apple is not expected to release a standard iPhone 18 model this year, according to a growing number of reports that suggest the company is planning a significant change to its long-standing annual iPhone launch cycle. Despite the immense success of the iPhone 17 in 2025, the iPhone 18 is not expected to arrive until the spring of 2027, leaving the iPhone 17 in the lineup as the latest...
duolingo ad live activity

Duolingo Used iPhone's Dynamic Island to Display Ads, Violating Apple Design Guidelines

Friday January 2, 2026 1:36 pm PST by
Language learning app Duolingo has apparently been using the iPhone's Live Activity feature to display ads on the Lock Screen and the Dynamic Island, which violates Apple's design guidelines. According to multiple reports on Reddit, the Duolingo app has been displaying an ad for a "Super offer," which is Duolingo's paid subscription option. Apple's guidelines for Live Activity state that...
Clicks Communicator Feature

'Clicks Communicator' Unveiled — Will You Carry This With Your iPhone?

Friday January 2, 2026 6:35 am PST by
The company behind the BlackBerry-like Clicks Keyboard accessory for the iPhone today unveiled a new Android 16 smartphone called the Clicks Communicator. The purpose-built device is designed to be used as a second phone alongside your iPhone, with the intended focus being communication over content consumption. It runs a custom Android launcher that offers a curated selection of messaging...
Low Cost MacBook Feature A18 Pro

Low-Price 12.9-Inch MacBook With A18 Pro Chip Reportedly Launching Early This Year

Friday January 2, 2026 9:08 am PST by
Apple plans to introduce a 12.9-inch MacBook in spring 2026, according to TrendForce. In a press release this week, the Taiwanese research firm said this MacBook will be aimed at the entry-level to mid-range market, with "competitive pricing." TrendForce did not share any further details about this MacBook, but the information that it shared lines up with several rumors about a more...
Apple Fitness Plus hero

Apple Announces New Fitness+ Workout Programs, Strava Challenge, and More

Friday January 2, 2026 6:43 am PST by
Apple today announced a number of updates to Apple Fitness+ and activity with the Apple Watch. The key announcements include: New Year limited-edition award: Users can win the award by closing all three Activity Rings for seven days in a row in January. "Quit Quitting" Strava challenge: Available in Strava throughout January, users who log 12 workouts anytime in the month will win an ...
Low Cost A18 Pro MacBook Feature Pink

Apple's 2026 Low-Cost A18 Pro MacBook: What We Know So Far

Friday January 2, 2026 4:33 pm PST by
Apple is planning to release a low-cost MacBook in 2026, which will apparently compete with more affordable Chromebooks and Windows PCs. Apple's most affordable Mac right now is the $999 MacBook Air, and the upcoming low-cost MacBook is expected to be cheaper. Here's what we know about the low-cost MacBook so far. Size Rumors suggest the low-cost MacBook will have a display that's around 13 ...
Mac Pro Feature Blue

What's Happening With the Mac Pro?

Wednesday December 31, 2025 9:59 am PST by
Apple hasn't updated the Mac Pro since 2023, and according to recent rumors, there's no update coming in the near future. In fact, Apple might be finished with the Mac Pro. Bloomberg recently said that the Mac Pro is "on the back burner" and has been "largely written off" by Apple. Apple apparently views the more compact Mac Studio as the ideal high-end pro-level desktop, and it has almost...