Skip to content

Instantly share code, notes, and snippets.

@bfred-it bfred-it/bookmarklet.js
Last active Jun 7, 2016

What would you like to do?
Play videos inline on the iPhone (bookmarklet)

Play videos inline on the iPhone (bookmarklet)

  1. Visit this page on on iPhone or iPod Touch
  2. Add this page to bookmarks
  3. Open your bookmarks
  4. Edit the bookmark you just saved
  5. Change the URL to:


  1. Save
  2. Open it on any page, like, and then touch the video directly (play buttons might still go fullscreen)

Note: this doesn't work on videos embedded via <iframe>

This bookmarklet is based on bfred-it/iphone-inline-video, a module that can be implemented on any website by web developers.

// to be flattened with
var s = document.createElement('script');
s.onload = function () {
[]'video'), makeVideoPlayableInline);
var s = document.createElement('style');
s.innerHTML = '.IIV::-webkit-media-controls-play-button,.IIV::-webkit-media-controls-start-playback-button,.IIV::-webkit-media-controls-fullscreen-button{opacity:0;pointer-events:none;width:5px}';
s = document.createElement('script');
s.onload = function() {
[]'video'), function(video) {
console.log('Enabling on', video);
video.addEventListener('webkitbeginfullscreen', function message() {
setTimeout(alert, 1000, 'If you didn’t want to go fullscreen, try touching the video instead, not the play buttons. If it does’t work, the website might not be compatible.');
video.removeEventListener('webkitbeginfullscreen', message);
video.onclick = function() {
video[video.paused ? 'play' : 'pause']();
s.src = '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.