<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - iOS 8 / OSX 10.10 WebGL - using a video from an other domain fails (CORS bug)"
   href="https://bugs.webkit.org/show_bug.cgi?id=135379#c79">Comment # 79</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - iOS 8 / OSX 10.10 WebGL - using a video from an other domain fails (CORS bug)"
   href="https://bugs.webkit.org/show_bug.cgi?id=135379">bug 135379</a>
              from <span class="vcard"><a class="email" href="mailto:electroteque&#64;gmail.com" title="Daniel Rossi &lt;electroteque&#64;gmail.com&gt;"> <span class="fn">Daniel Rossi</span></a>
</span></b>
        <pre>Here is some Es6 from static utils to deal with the CORS detection problem. It has driven me over the edge. I know people have given up on Safari but people want and need this to work.  

Both IOS 10 Safari and Yosemite Safari 10 report CORS feature detection but obviously do not, this was a recent sabotage in Safari 10. 

Extra platform and version checks are required. This is rough as guts but I have no time or stomach to fine tune it further. If it doesn't support CORS the property should not be available as before. 

I have to specifically check for both Safari and OSX 10.12 and above. This will break in the future of course. 


static supportsCORS() {
        let testVideo = document.createElement(&quot;video&quot;),
            hasCORS = false;

        testVideo.crossOrigin = &quot;anonymous&quot;;
        hasCORS = testVideo.hasAttribute(&quot;crossOrigin&quot;);
        testVideo = null;

        if (hasCORS) {

            if (WebVRUtils.isSafari) {

                if (WebVRUtils.isIpad) return false;
                return WebVRUtils.isNewSafari;
            }

            return true;
        }

        return false;

    }

    static get isSafari() {
        const userAgent = navigator.userAgent;
        return (/Safari/i).test(userAgent) &amp;&amp; !(/Chrome/i).test(userAgent);
    }

    static get isIpad() {
        const userAgent = navigator.userAgent;
        return (/iP(hone|od|ad)/i).test(userAgent);
    }

    static get isNewSafari() {
        const version = /Mac OS X (10[\.\_\d]+)/.exec(navigator.userAgent)[1].split(&quot;_&quot;)[1];
        return +version &gt;= 12;
    }</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>