[wp-trac] [WordPress Trac] #44610: Allow Youtube-Player to use youtube-nocookie.com URLS to avoid setting cookies.

WordPress Trac noreply at wordpress.org
Mon Jul 23 12:16:57 UTC 2018


#44610: Allow Youtube-Player to use youtube-nocookie.com URLS to avoid setting
cookies.
-------------------------------------------------+-------------------------
 Reporter:  jepperask                            |       Owner:  (none)
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:
Component:  Customize                            |     Version:  4.9.7
 Severity:  normal                               |  Resolution:
 Keywords:  needs-testing 2nd-opinion needs-     |     Focuses:  privacy
  unit-tests has-patch                           |
-------------------------------------------------+-------------------------

Comment (by jepperask):

 Thank you for the feedback. It appears I was missing some parentheses in
 the javascript code:
 {{{#!php
 host: location.protocol + ((this.settings.videoUrl.indexOf("youtube-
 nocookie") !== -1) ? "//www.youtube-nocookie.com" : "//www.youtube.com"),
 }}}


 Using my changes to the code, I succesfully got it to play the following
 URLs (TwentySeventeen setting the Header Media on a fresh install):
 http://youtube-nocookie.com/embed/sRrqF8eXs38
 http://www.youtube-nocookie.com/embed/sRrqF8eXs38
 https://www.youtube-nocookie.com/embed/sRrqF8eXs38
 https://www.youtube-nocookie.com/watch/?v=sRrqF8eXs38

 I'll test more if needed. @birgire how did you test the URLs? If you
 inspect the JS-file, you will find that the Regex is extracting the video-
 ID, and regardless of what the original URL was, it will appropriately set
 the URL to {schema}//(youtube|youtube-nocookie).com/embed/{ID}.
 Schema is set to location.protocol, as I was unable to set the host
 argument with https when called from my localhost (http).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44610#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list