jetlej
jetlej

Reputation: 3392

HTML comment closing tag being ignored in IE

The following comment closing tag is being ignored in IE (all versions), so a ton of the following elements are commented out:

<a class="dynamic_embed_video">
   <?php echo '<!-- ' . get_post_meta($post->ID, "embed_code") . ' -->'; ?>
</a>

In IE, the outputted comment continues past the closing tag and does not end until another comment open and close tag further down the page.

(FYI the reason I'm doing this is to dynamically embed videos upon the user clicking a preview image to quicken page load time)

Upvotes: 0

Views: 181

Answers (2)

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324650

Try wrapping the output of get_post_meta inside htmlspecialchars to make it "safe" to dump in HTML output.

Upvotes: 2

yvan
yvan

Reputation: 958

And if you do like that

<a class="dynamic_embed_video">
   <!-- <?php echo get_post_meta($post->ID, "embed_code"); ?> -->
</a>

Does it still ignored by IE ?

Also, check the code returned by your function and look if there is another HTML comment inside.

Upvotes: 2

Related Questions