How to programmatically embed iframe in a page I am trying to render a page with iframe embedded in it. My code is as follow 

public function giveHugs() {
  return [
    '#type' =&gt; 'inline_template',
    '#template' =&gt; '&lt;iframe frameborder="0" style="border: none;" width="400" height="400" src="{{ url }}"&gt;&lt;/iframe&gt;',
    '#context' =&gt; [
      'url' =&gt; 'yahoo.com'
    ]
  ];
}


Some how its not rendering the iframe , rather it is embedding the drupal site it self. How can i render iframe in a page?
Unless you provide an absolute URL, Drupal will treat it as relative. So yahoo.com becomes https://example.com/yahoo.com, which explains why you're seeing your own site embedded.

To solve, just use an absolute URL:

'#context' =&gt; [
  'url' =&gt; 'https://yahoo.com'
]