responsive iframe

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
IMPORTANT NOTE!!

DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.



PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

responsive iframe

Post by alexoliveira »

I would like to know if there is a way to make the iframe responsive to height with content?
S.A
User avatar
BaconFries
 
 
Posts: 5541
Joined: Thu Aug 16, 2007 7:32 pm

Re: responsive iframe

Post by BaconFries »

Haven't you previously asked this? see the following from yourself with Pablos reply to you with a possible solution.
I say the iframe of the page exists how to make it responsive?
viewtopic.php?p=468801#p468801
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

the method taught is not working or something is not right, follow the link to see

https://jbastosimoveis.com.br/im%C3%B3veis/7192.php
S.A
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

Could you send the code on how to turn the iframe into responsive at the height?
S.A
User avatar
zinc
 
 
Posts: 2152
Joined: Sat Dec 08, 2007 3:06 pm
Location: London, United Kingdom
Contact:

Re: responsive iframe

Post by zinc »

Maybe this might be what you are looking for?

https://wwb.art-studio.top/index.php?ro ... duct_id=72
Running WYSIWYG Web Builder since 2007...
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

Guys, I really need a solution here, if anyone can help.
S.A
User avatar
BaconFries
 
 
Posts: 5541
Joined: Thu Aug 16, 2007 7:32 pm

Re: responsive iframe

Post by BaconFries »

Guys, I really need a solution here, if anyone can help
Understand you need a solution but have you looked at the two suggestions given one by Pablo and zinc either one will work.
Pablo wrote: Sat Dec 18, 2021 7:11 am Maybe this will be helpful?
https://www.tutorialrepublic.com/faq/au ... script.php

Note that this may not work because of browser security restrictions
zinc wrote: Fri Jan 26, 2024 2:24 pm Maybe this might be what you are looking for?

https://wwb.art-studio.top/index.php?ro ... duct_id=72
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

Code: Select all

<script>
    // Selecting the iframe element
    var iframe = document.getElementById("imovel");
    
    // Adjusting the iframe height onload event
    iframe.onload = function(){
        iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
    }
    </script>

when adding the iframe in the code, it doesn't work
Last edited by alexoliveira on Fri Jan 26, 2024 5:03 pm, edited 2 times in total.
S.A
User avatar
BaconFries
 
 
Posts: 5541
Joined: Thu Aug 16, 2007 7:32 pm

Re: responsive iframe

Post by BaconFries »

The reason it doesn't work is because it is only meant as an "Example" for it to work you will need to reference your own iframe with its id. Please note if you wish to use external code it is for reference only and you need to know how to use it yourself.
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

yes, I added the id correctly with the iframe that is on the page, id name: imovel
S.A
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

the iframe id: imovel in the code notice that I put imovel too, I added it in the <head></head>
S.A
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

:shock:
S.A
User avatar
BaconFries
 
 
Posts: 5541
Joined: Thu Aug 16, 2007 7:32 pm

Re: responsive iframe

Post by BaconFries »

Can you provide a url with just a iframe with how you have added the code nothing else so it can be viewed.
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

S.A
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

What to do in this case, the code points to the iframe id, it still doesn't work :shock:
S.A
User avatar
BaconFries
 
 
Posts: 5541
Joined: Thu Aug 16, 2007 7:32 pm

Re: responsive iframe

Post by BaconFries »

The reason why it doesn't work is because you have not included the required style!!.

Code: Select all

<style>
iframe{
width: 100%;
border: 2px solid #ccc
}
</style>
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

where should I put the style?
S.A
User avatar
BaconFries
 
 
Posts: 5541
Joined: Thu Aug 16, 2007 7:32 pm

Re: responsive iframe

Post by BaconFries »

You insert via Page HTML Between the <head></head> tags*
User avatar
crispy68
 
 
Posts: 2833
Joined: Thu Oct 23, 2014 12:43 am
Location: Acworth, GA
Contact:

Re: responsive iframe

Post by crispy68 »

I think you are going to have issues getting the iframe to be 100% if the page you are showing in the iFrame is from another domain. If you are hosting the page yourself then it should work. If not, there are solutions for cross domain but you have to have access to the other domain to add some code for it to work.

Otherwise, I think you will need to set a specific height to the iframe. You can use CSS.

Code: Select all

<style>
#imove1{width:100%;height:800px;}
</style>
You could also set height to 100vh and that would make it at lease a minimum height of the browser window.
User avatar
BaconFries
 
 
Posts: 5541
Joined: Thu Aug 16, 2007 7:32 pm

Re: responsive iframe

Post by BaconFries »

crispy68 (Ron) the css I gave is not by me it was from the original author at the following url below I only gave as alexoliveira hadn't added it to anywhere in his page source only the javascript.
https://www.tutorialrepublic.com/faq/au ... script.php
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

Yes, the iframe domain is on the same hosting as the website, I'm kind of integrating a real estate system on the website made in wysiwyg, which I'm not able to do and make the iframe 100% responsive in height to show the complete content.
S.A
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

zinc wrote: Fri Jan 26, 2024 2:24 pm Maybe this might be what you are looking for?

https://wwb.art-studio.top/index.php?ro ... duct_id=72
Does your extension work for links outside of wysiwyg?
S.A
User avatar
BaconFries
 
 
Posts: 5541
Joined: Thu Aug 16, 2007 7:32 pm

Re: responsive iframe

Post by BaconFries »

Other than what I have written have you tried crispy68 suggestion? Also note if the page you are viewing in the iframe the (real estate) is not responsive itself then it will not adjust with the iframe meaning you will need to make the (real estate) page responsive.
User avatar
BaconFries
 
 
Posts: 5541
Joined: Thu Aug 16, 2007 7:32 pm

Re: responsive iframe

Post by BaconFries »

zinc wrote: Fri Jan 26, 2024 2:24 pm Maybe this might be what you are looking for?

https://wwb.art-studio.top/index.php?ro ... duct_id=72
Does your extension work for links outside of wysiwyg?
Please contact the developer of the extension for all questions on how it works.
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

Yes, the iframe page is 100% responsive, but I still couldn't make the code work in the iframe, here's the code:

Code: Select all

<script>
    // Selecting the iframe element
    var iframe = document.getElementById("imovel");
    
    // Adjusting the iframe height onload event
    iframe.onload = function(){
        iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
    }
</script>
<style>
iframe{
width: 100%;
border: 2px solid #ccc
}
</style>
S.A
User avatar
BaconFries
 
 
Posts: 5541
Joined: Thu Aug 16, 2007 7:32 pm

Re: responsive iframe

Post by BaconFries »

Did you read my reply about trying the css suggestion by crispy68?.
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

yes, but in this case of css, can I make the iframe responsive in height?
S.A
User avatar
crispy68
 
 
Posts: 2833
Joined: Thu Oct 23, 2014 12:43 am
Location: Acworth, GA
Contact:

Re: responsive iframe

Post by crispy68 »

Does the real estate system offer any sort of embed code to embed it on a website?

Using my suggestion will only make the iframe as long as the browser window. If the content in the iframe is longer than the browser window, you will still have vertical scrollbars.
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

Yes, it supports it, it is responsive when accessed by mobile device, the problem here is making the iframe responsive, as I already had this happen in previous versions of wysiwyg, after updating to the new one, it no longer worked.
S.A
User avatar
Pablo
 
Posts: 22162
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: responsive iframe

Post by Pablo »

This has nothing to with WWB. An Inline frame is a standard HTML feature. it work the same as in previous versions.
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

The code is not working. How to make the iframe adjust to the size of the content inside the iframe. i.e. make the iframe responsive in autura.
S.A
User avatar
Pablo
 
Posts: 22162
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: responsive iframe

Post by Pablo »

If the code does not work then this is unrelated to WWB, it an issue with your code.
Please check the error console of the browser to see why it does not work.
User avatar
BaconFries
 
 
Posts: 5541
Joined: Thu Aug 16, 2007 7:32 pm

Re: responsive iframe

Post by BaconFries »

The code is not working. How to make the iframe adjust to the size of the content inside the iframe. i.e. make the iframe responsive in autura.
If it doesn't work then it is the script itself and not related to WWB. You should contact the script developer for help. Note it was provided for you to try and hopefully you could use it on the understanding you know how to use and insert correctly yourself.
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

I completely understand that it is not related to WWB, I am just here for a solution, I would really like to make the iframe responsive in height.
I tried using the extension iframe resizer but I have no solution.
S.A
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

some extension that automatically adjusts the height of the iFrame according to its content?
S.A
User avatar
Pablo
 
Posts: 22162
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: responsive iframe

Post by Pablo »

Yes, but this only works if you have control over the page inside the frame:
https://www.wysiwygwebbuilder.com/iframeresizer.html

But did you check this?
Please check the error console of the browser to see why it does not work.
This should give you a clue why it does not work.
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

I don't understand how to use this pablo extension, is there anything easier to use?
S.A
User avatar
Pablo
 
Posts: 22162
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: responsive iframe

Post by Pablo »

No, there is nothing easier.
But did you read the documentation?
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

still unsuccessful, If someone could send a zip file, with wysiwyg already working with a responsive iframe, it would help me a lot.
S.A
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

Can anyone with a responsive iframe already work please send it?
S.A
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

Any solution please team?
S.A
User avatar
crispy68
 
 
Posts: 2833
Joined: Thu Oct 23, 2014 12:43 am
Location: Acworth, GA
Contact:

Re: responsive iframe

Post by crispy68 »

The iframeresizer extension that Pablo mentioned is probably the best way to handle this but you have to have access to page in the iframe. If you are hosting it on your own site, then I would think you should have access to use it. You will need to follow the instructions in adding to both pages. It is really hard to help you when we don't have access to the page in the iframe. If we try, then it is cross domain which causes issues and we don't have access to your page, so there is no way for us to create a working example to test and give you.

What software are you using for whats in the iframe?
User avatar
BaconFries
 
 
Posts: 5541
Joined: Thu Aug 16, 2007 7:32 pm

Re: responsive iframe

Post by BaconFries »

It is really hard to help you when we don't have access to the page in the iframe.
crispy68 (Ron) the site in question is the following:
https://adm.jbastosimoveis.com.br/imove ... esidencial
User avatar
crispy68
 
 
Posts: 2833
Joined: Thu Oct 23, 2014 12:43 am
Location: Acworth, GA
Contact:

Re: responsive iframe

Post by crispy68 »

So I'm assuming this is on a 3rd party site then? I was under the impression he was hosting it on his own server. If 3rd party then the extension won't work.
User avatar
BaconFries
 
 
Posts: 5541
Joined: Thu Aug 16, 2007 7:32 pm

Re: responsive iframe

Post by BaconFries »

I believe so, viewing the source it is a "theme" meaning it could be from the likes of Drupal/Joomla or something similar.
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

Guys, the site is hosted on my server, what should I do next, add some code to the page that goes in the iframe?
S.A
User avatar
Pablo
 
Posts: 22162
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: responsive iframe

Post by Pablo »

You still have not included a demo of what you have done. That makes it very difficult to help you...

Image
alexoliveira
 
 
Posts: 189
Joined: Fri Oct 01, 2021 5:12 am
Contact:

Re: responsive iframe

Post by alexoliveira »

Here's a demo of how I'm using the iframe with the code
https://startagencia.net.br/demo.zip
S.A
User avatar
Pablo
 
Posts: 22162
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: responsive iframe

Post by Pablo »

The code does not work because the page displayed inside the inline frame in not in the same domain. So, it cannot be accessed for security reasons.
You can check this in the error console of the browser.
User avatar
crispy68
 
 
Posts: 2833
Joined: Thu Oct 23, 2014 12:43 am
Location: Acworth, GA
Contact:

Re: responsive iframe

Post by crispy68 »

So I put together a demo using the code for iframe resizer. You will need to add the code manually because there will be code needed to be added to the page you want to show in the inline frame.

Here is my demo:
https://wizbangwebdesign.com/demo/frame/

My demo is a header and footer with the inline frame in between.

To make it work, visit https://github.com/davidjbradshaw/iframe-resizer and download the zip file and unzip it.

The steps below assume that you have your .js files in a separate folder on the server.

1. In WB, add a HTML box and add the following code set to the before </body> tag:

Code: Select all

<script type="text/javascript" src="js/iframeResizer.min.js"></script>
<script>
  iFrameResize({}, '#InlineFrame1')
</script>
Between the {} above you can add other options (see the github link above for more info). Make sure to change the ID in the above code to match your inline frame ID.

2. You will need to access the page you want to appear in the inline frame and add the following code at the end of the HTML before the end body tag </body>:

Code: Select all

<script type="text/javascript" src="js/iframeResizer.contentWindow.min.js" defer=""></script>
3. You will need to upload the following .js files to the appropriate spots. Both of these files can be found in the downloaded js folder from github:

iframeResizer.min.js = upload this file to the .js folder for page that contains the iframe
iframeResizer.contentWindow.min.js = upload this file to the .js folder for the page that is appearing in the iframe.


NOTE: I will leave my demo up for a very short time for viewing and then it will be removed.
Post Reply