-1

I was trying to implement some js my own, but in the end i needed to set height manually.

https://sklepdruku.pl/project/wizytowki-klasyczne/

What type of script i need to use here to make it work?

1 Answers1

1

If you want to set the height of an iframe according to the height of its content, and the iframe content is on the same domain than the parent, this is your answer:
Adjust width height of iframe to fit with content in it
If the iframe content isn't on the same domain, and if you can't edit the iframe content directly from the source, maybe you can:

  1. make an ajax request to an internal php with the iframe url in request parameters
  2. in the php file create (or empty if already created) a file in wich you will put the height value
  3. download (with curl or file_get_contents) the content of the iframe and save it in a html file
  4. edit the downloaded page and put in some js to get the document height
  5. edit the downloaded page and put in some js to make a ajax request to a second php file, put the document height in the ajax request parameters
  6. make a request from the current php file to the edited html file, this will execute the ajax request wich will call the second php file
  7. in the second php file get the height parameter and put it in the file that you created in the n.2
  8. from the first php file open and read the file in wich the height has been saved and return the value to your first ajax request.
  9. set the iframe height value with the ajax response value

I don't try, but it can work. Maybe you had to set an infinite loop before returning the height to your first ajax request. The loop will break only when the file with the height value won't be empty, or if the timeout expired(set a short timeout for the execution of php).

ggirodda
  • 770
  • 7
  • 19