Reputation: 71
On my SPA app for instagram I use this code:
window.instgrm.Embeds.process()
Upvotes: 7
Views: 1245
Reputation: 1
I did it in such a way that after adding iframe, I call the function:
if (typeof window.tiktok !== "undefined") { window.tiktok.load(); }
I write in typescript so I also had to add tiktok.d.ts definitions:
declare global {
interface Window {
tiktok: any;
}
}
export {};
For instagram I have the same
if (typeof window.instgrm !== "undefined") { window.instgrm.Embeds.process(); }
Definition instgrm.d.ts
declare global {
interface Window {
instgrm: any;
}
}
export {};
Upvotes: 0
Reputation: 1
For anyone coming here after all these years wondering I solved it like this
const tiktoksOnPage = Array.from(
document.querySelectorAll('blockquote.tiktok-embed'),
);
if (typeof tiktokEmbed !== 'undefined' && tiktoksOnPage.length) {
tiktokEmbed.lib.render(tiktoksOnPage);
}
You need to embed the script of course
Upvotes: 0