angular / universal

Server-side rendering and Prerendering for Angular
MIT License
4.04k stars 484 forks source link

Generated static index.html fails w3.org validator #882

Closed jorgjanke closed 6 years ago

jorgjanke commented 6 years ago

Note: for support questions, please use one of these channels: https://github.com/angular/universal/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports. Also, Preboot has moved to https://github.com/angular/preboot - please make preboot-related issues there.

Nu Html Checker output: . Error: The character encoding was not declared. Proceeding using windows-1252. . Error: A charset attribute on a meta element found after the first 1024 bytes. . Error: Changing character encoding utf-8 and reparsing. . Fatal Error: Changing encoding at this point would need non-streamable behavior.

Toxicable commented 6 years ago

I just tried this with the Universal Starter we only got this error:

The type attribute is unnecessary for JavaScript resources.

Which is unrelated to Universal, that's an issue with the CLI not with Universal itself

Could you provide a minimal reproduction?

jorgjanke commented 6 years ago

Using the Universal Starter as a baseline

I think the problem is (in app.module.ts):

PrebootModule.withConfig({
  appRoot: 'app-root'
}),

The functions in the script tag include

function waitUntilReady(data, win) {..}
function start(prebootData, win) {..}
function createOverlay(_document) {..}
function getAppRoots(_document, opts) {..}\

After commenting out the PrebootModule, the index.html did not have the script tag.

So the problem is that generating the PrebootModule, creates the code directly in the index.html file rather creating a js file and then referencing that file.

Toxicable commented 6 years ago

Sounds like an issue with preboot, we have no control here over what code generated there

Toxicable commented 6 years ago

Closing this as it appears to not be an issue with Universal

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.