Tiktok embed video CORB issue in VUE js

4.7k views Asked by At

This HTML works fine and the TikTok video showed perfectly (simple index.html file). But the problem is when I used this code in VUE js it gives me a CORS error

cors

<!DOCTYPE html>
<html lang="en">
<head>
 <script async src="https://www.tiktok.com/embed.js"></script> 
</head>

<blockquote class="tiktok-embed" cite="https://www.tiktok.com/@zachking/video/6904661755687865605"
    data-video-id="6904661755687865605" style="max-width: 605px;min-width: 325px;">
    <section> <a target="_blank" title="@zachking" href="https://www.tiktok.com/@zachking">@zachking</a>
        <p>What’s the longest amount of time you’ve been stuck in <a title="traffic" target="_blank"
                href="https://www.tiktok.com/tag/traffic">#traffic</a> ? �</p> <a target="_blank"
            title="♬ original sound - Zach King" href="https://www.t
    k.com/music/original-sound-6904661761874479877">♬ original sound - Zach King</a>
    </section>
</blockquote>
<video></video>
</html>

I placed this script tag in the index.html file of vue in the head section

<script async src="https://www.tiktok.com/embed.js"></script> 

I don't know why it gives CORS error. Any solution for this?

1

There are 1 answers

0
TAT On

In my case, this code worked fine.

// In the template of the Vue file

<iframe :src="videoUrl" :srcdoc="embedHtml"></iframe>

<script async src="https://www.tiktok.com/embed.js"></script> in the head tag of index.html was unnecessary.