The QString::replace() had no effect because the stream actually contains <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">, not just <!DOCTYPE html>.
Also, the <meta> tag should be inside the <head> section.
BUG: 374260