In some occasions, I have pages without any content but a script that does something (ex. sending data through postMessage then closing itself).
In such cases, is the page valid with just <script>doSomeStuff</script>
or does it also require a doctype like so:
<!DOCTYPE html>
<html>
<script>doSomeStuff</script>
</html>
Or does the page need full html declaration like:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>doSomeStuff</script>
</head>
</html>
One might think it's wiser to include <meta charset="UTF-8">
since otherwise the page could suffer from encoding errors and the script mis – or never – interpreted.