Reputation: 1916
I have a field in the database which store script tags and I want to implement those script tags into my HTML file but the problem is that data is coming string format
I am trying this
<div class="mb-auto">{{htmlentities($video->ifram)}}</div>
Desired output
<script id="154896_p_269505" width="1280" height="720" src="" class="dacast-video"></script>
But getting
"<script id="154896_p_269505" width="1280" height="720" src="https://player.dacast.com/js/player.js?contentId=154896_p_269505" class="dacast-video"></script>"
Upvotes: 1
Views: 1870
Reputation: 3529
You can achieve this by replacing
<div class="mb-auto">{{htmlentities($video->ifram)}}</div>
with
<div class="mb-auto">{!! $video->ifram !!}</div>
But you should be very careful about XSS attack since the JavaScript present in your string will be interpreted by the browser. NEVER do it with a user-provided content!
Upvotes: 2