WordPress.org

Make WordPress Core

Opened 9 months ago

Last modified 4 months ago

#48698 new defect (bug)

Update fails if there’s a "Custom Html" block and an Iframe inside it

Reported by: ozgurnevres Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.3
Component: Editor Keywords:
Focuses: Cc:

Description

When creating a new post or updating an old post, If there's a "Custom Html" block with an Iframe inside it, save always fails - regardless of what's in that block.

It gives the following error:
Updating failed. Error message: The response is not a valid JSON response.

Change History (5)

#1 @JarretC
9 months ago

Hello! I've tried replicating this issue but not having any luck.

I add a new Custom HTML block into a post, then input the following into the input field

<iframe>testing</iframe>

Then press Update and it succeeds without error. I'm also able to view the iframe on the front end of the site. If you have any plugins activated or not using a default theme such as Twenty Twenty/Twenty Nineteen/etc, please try deactivating all plugins and switching to a default theme.

If you still have the issue, please reply with more details here on how to replicate further.

Thanks!

#2 @ozgurnevres
9 months ago

Hi,

I've tried with this and getting the error:

<iframe src="http://content.jwplatform.com/players/MnVLH1Ps-puACk8ZV.html" width="320" height="260" frameborder="0" scrolling="auto"></iframe>

#3 @JarretC
9 months ago

Thanks! I tried out that code as well and didn't have any issues getting it added/saved into the post.

Is that the only content/block on the post/page or do you have other stuff in there? Also, did you deactivate all active plugins and try using a default theme as well?

#4 @SergeyBiryukov
9 months ago

Hi there, welcome to WordPress Trac! Thanks for the report.

Just noting that I could not reproduce the issue on a clean install. This sounds like an issue triggered by a plugin or some overzealous security rule on the server.

Some similar issues: #25564, #25736, #32571, #33160, #44861, #45368, #48673.

Last edited 4 months ago by SergeyBiryukov (previous) (diff)

#5 @stidch
7 months ago

I also face an issue here with pages and iframes.

My iframe is embedded in a shortcode. I cannot save any page, which contain a shortcode, which contain an iframe.

For example:

onload="resizeIframe(this)"

In my case I try to resize an iframe with the advanced-iframe plugin. The full shortcode looks like this:

advanced_iframe src="https://xxx.com/script.php?parameter=value" frameborder="0" scrolling="no" onload="resizeIframe(this)"

In an html block above I'v defined the resizeIframe method.

<script>
function resizeIframe(iframe) {
  iframe.height = "10px" // required for reducing the size
  iframe.height = iframe.contentWindow.document.body.scrollHeight + "px";
}
</script>

If I remove the part

onload="resizeIframe(this)

from the shortcode I can successfully save the page. With I can't.

I've tried already with disabled plugins and default theme.

Note: See TracTickets for help on using tickets.