Repeat youtube in loop – No page refresh or multi load – no browser plugin or 3rd party site

Many times I wish to listen to a youtube song in repeat mode; but unfortunately youtube doesn’t provide a repeat button (probably because of fake view count). Few sites let you repeat the song and the same can be done using some browser plugin too; but I don’t prefer any of them because of the following reasons.

Problem with third party site

  • Loads the video again and again; thus unnecessary bandwidth loss.
  • Displays ads for their own benifit, which is annoying to me.
  • I like youtube as youtube, not really interested browsing another site or everytime copying and pasting the youtube url in that that third party site.

Problem with browser plugins

  • I have serious security related trust issue with browser plugins, cause a browser plugin can do anything with your DOM.
  • Sometimes they also pushes advertisement in your DOM.

So what I did is wrote a JavaScript code which will just hit the replay button once your video is completed. I saved it as bookmarklet and whenever I want to repeat I just click on the bookmarklet.

Steps to do it

Adding the bookmarklet is easy and an one time effort. Steps are given below to add this in your browser.

Step 1

  • Open a new tab.
  • Click on bookmark icon.
  • Click on edit

bookmark1

Step 2

  • After clicking the edit button you will find a dialog box asking for bookmark name and url.
  • Give your desired name (Eg: youtube repeat)
  • Copy the ugly code below and paste in place of url.

Step 3

  • Save it. Before saving you may select the position where you want to save (bookmark bar or in some other folders)
  • That’s it. Now after opening any youtube video just click on that bookmark you saved and your video will be in repeat mode.
  • Clicking on the bookmark for the second time will stop the repeat.

bookmark2

bookmark3

Benefits of this approach

  • The video will be loaded only once. Thus your bandwidth loss will not occur.
  • Click once and any video you open in that tab will automatically fall in repeat.
  • No need to go to a third party site, you can access youtube as it is.
  • No unnecessary ads.
  • No trust issue.
About This Author

Hello! I am Paul Shan, a JavaScript Expert, Full Stack and DevOps Engineer cum Consultant based out of Bengaluru, India.

  • Rameez Aftab

    this doesn’t work !!!! any further help will be appreciated..

  • FervidWhirl Disc

    i don’t have a yellow star in address bar, what is the other way to enter this edit options?

    • Paul Shan

      All browsers support bookmarking. All you need to do is to bookmark the code

  • Ian Yang

    Displays ads for their own benifit, which is annoying to me.

    That’s not an appropriate reason, in my opinion, when the website you wrote this article on displays ads, too. Those third party sites aren’t charity sites, and thus they of course need a source of income. As long as their ads don’t interrupt users, I think no one needs to be blamed.

    And your code isn’t working for embedded videos.

    • Paul Shan

      My ads don’t take any precious thing from you. But youtube ads do. That precious thing is called TIME. Trust me it’s more precious than bitcoin.
      That’s the reason I only use video ad blocker ad not display ads.
      Anyway, whatever it is, it’s my personal opinion.

      To reply your query; it’s an old script. I haven’t updated it since the time youtube introduced loop feature it itself. Right click on the video and you will find loop.