I'm working on creating iframe in magento2.

Content of this iframe should be a custom form, which exists in one of templates.

I made following:

<iframe src="<?php echo $this->getUrl('module/iframe/show') ?>" frameborder="0" style="height:75px;"></iframe>

It means that my controller module/iframe/show should return me a content for this form, but I don't know what exactly should return/render/output my controller. Now I can receive only full rendered page in this iframe. It means that probably block side is working well and i need only proper controller code

1 Answer 1


I have found an answer in default magento modules.

Some variables (block_name, form_id) were replaced with strings to clearly understand the idea.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.