Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run script in v-html

Tags:

I get embed codes (Instagram, Twitter and so on) from database. How to bind them to a vue component? Is there any way for executing script tag in v-html?

like image 456
GrayRF Avatar asked Jun 16 '17 18:06

GrayRF


1 Answers

Short answer: You can't. Your browsers blocks the execution of script tags once the dom has loaded.

Long answer: You could try matching the src attribute of the script and fetch + evaluate it, or match the inner content of the div and evaluate it, but this is not recommended.

like image 128
Antony Avatar answered Oct 11 '22 10:10

Antony