Embeds: Add a CDATA and HTML comment wrapper around the JavaScript included in the embed HTML. This ensures that user agents which naively strip unwanted tags, without also stripping the content within those tages (for example, Slack), don't show the embed as a mess of JavaScript.
Props peterwilsoncc. Fixes #34429. git-svn-id: https://develop.svn.wordpress.org/trunk@35406 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c608146996
commit
9387dff5af
@ -466,6 +466,7 @@ function get_post_embed_html( $post = null, $width, $height ) {
|
||||
$embed_url = get_post_embed_url( $post );
|
||||
|
||||
$output = "<script type='text/javascript'>\n";
|
||||
$output .= "<!--//--><![CDATA[//><!--\n";
|
||||
if ( SCRIPT_DEBUG ) {
|
||||
$output .= file_get_contents( ABSPATH . WPINC . '/js/wp-embed.js' );
|
||||
} else {
|
||||
@ -483,6 +484,7 @@ function get_post_embed_html( $post = null, $width, $height ) {
|
||||
include "js/wp-embed.min.js"
|
||||
JS;
|
||||
}
|
||||
$output .= "\n//--><!]]>";
|
||||
$output .= "\n</script>";
|
||||
|
||||
$output .= sprintf(
|
||||
|
Loading…
Reference in New Issue
Block a user