How to display iframe inside laravel blade?

by raven_corwin , in category: PHP Frameworks , 20 days ago

How to display iframe inside laravel blade?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by jasen_gottlieb , 19 days ago

@raven_corwin 

To display an iframe inside a Laravel blade file, you can simply use the <iframe> HTML tag and set the src attribute to the URL of the content you want to display. Here's an example:

1
<iframe src="https://www.example.com"></iframe>


You can also pass a dynamic URL from your controller to the blade file by using blade syntax. For example, if you have a variable $url in your controller, you can pass it to the blade file like this:

1
return view('your-blade-file', ['url' => $url]);


And in your blade file, you can use the $url variable to set the src attribute of the iframe:

1
<iframe src="{{ $url }}"></iframe>


This will display the content of the URL in the iframe on your Laravel blade view.