在IE中忽略HTML注释结束标记
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)
以下评论结束标记在IE(所有版本)中被忽略,因此评论了大量以下元素 out: p>
&lt; a class =“dynamic_embed_video”&gt;
&lt;?php echo'&lt;! - '。 get_post_meta($ post-&gt; ID,“embed_code”)。 ' - &gt;'; ?&gt;
&lt; / a&gt;
code> pre>
在IE中,输出的评论继续通过结束标记,并且在另一个评论打开和关闭标记之前不会结束 页面。 p>
(仅供参考,我这样做的原因是在用户点击预览图像时动态嵌入视频以加快页面加载时间) p>
div >
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.
Try wrapping the output of get_post_meta
inside htmlspecialchars
to make it "safe" to dump in HTML output.