News Score: Score the News, Sort the News, Rewrite the Headlines

How not to break a site – sirre.al

<script> tags follow unintuitive parsing rules that can break a webpage in surprising ways. Fortunately, it’s relatively straightforward to escape JSON for script tags. Just do this Replace < with \x3C or \u003C in JSON strings. In PHP, use json_encode($data, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES) for safe JSON in <script> tags. In WordPress, use wp_json_encode with the same flags. You don’t have to take my word for it, the HTML standard recommends this type of escaping: The easiest and safest …...

Read more at sirre.al

© News Score  score the news, sort the news, rewrite the headlines · Built by Brad Jasper