question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resize iframe on form submit

See original GitHub issue

Hi

Great code! I got my iframe to resize after hours of trying different things. But I have a problem. I got this form on inside the iframe.

<form class="search" action="http://sinsio.dk/search.php" method="get">
<input name="s" id="s" type="text" value="" placeholder="Søg i over 200.000 produkter" /> <input type="submit" value="Søg" />
<input type="hidden" name="post_type" value="product" />
</form>

This changes the content of the iframe to my seach result but the iframe does not resize on this page. Is it possible to resize the search.php page? The file is on the same domain as the original iframe source.

I tried to copy the javascript code from my original iframe but that does not work.

<script>
var iFrameResizer = {
	messageCallback: function(message){
		alert(message,parentIFrame.getId());
	}
}
</script>
<script type="text/javascript" src="https://sinsio.dk/iframe-resizer-master/js/iframeResizer.contentWindow.min.js" defer></script>
<script>
	parentIFrame.size();
</script>

The iframe on the search result page is the same as the height of the iframe before the search.

Any ideas how to solve this?

Kind regards, Michael

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mstorm85commented, Jul 13, 2017

That also worked for me! Thanks for sharing the solution 😃

0reactions
Webteam-IDWcommented, Jul 13, 2017

our Problem is solved by changing the Parameter checkOrigin to false, because we link to another URL in the iframe.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resizing the iframe after form submit doesn't work
I have the following html file. I have a form which upon submit should call the foo() function. The foo() function should make...
Read more >
Embedded Google Forms: how resize the height of the iframe ...
How to resize the height of the iframe after a submit ... In this short article we are going to show a simple...
Read more >
Resize an iframe based on the content - GeeksforGeeks
The iframe HTML element is often used to insert contents from another source. Contents which needs resizing is done indirectly using a div...
Read more >
Embedded forms do not resize the iFrame code properly and ...
I have checked your forms and submitted a few form submissions from different browsers to encounter the issue but I am not able...
Read more >
Auto-resize Iframe when Content Size Changes - WillMaster
An iframe is a section of a web page where the content of another web page can be published. It's done with an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found