Closed robobenklein closed 7 years ago
There seems to be yet another problem, this time involving the URL-encoding or escaping of the ampersands in the URL sent in the Link Preload header:
I get a preload like https://323.robosane.net/component/scriptmerge/?format=raw&tmpl=component&type=css&app=0&version=1&files=JEZwbHVn
Notice the & things, which make chrome do this: (Obviously they shouldn't be escaped there...)
And then Chrome has to send another request with the correct url options when it gets to the html-contained link:
So the preload header didn't really do it's job here...
I think the problem is the auto-encoding done by header, probably here? https://github.com/yireo/pkg_scriptmerge/blob/96310a10b681f8cfd29f842f3750ac872478a0fb/source/plugins/system/scriptmerge/scriptmerge.php#L692
Does the header function have an option not to replace the ampersands?
Found a solution: http://php.net/manual/en/function.htmlspecialchars-decode.php
https://github.com/yireo/pkg_scriptmerge/pull/25 should fix this.
There seems to be a small issue in the preload header generation, an extra / is added after the domain, causing the browser to treat the same merged CSS as two different sources.
In the HTTP Header:
But then in the page's html:
The extra / in the preload header causes Chrome to preload it, but then re-download since it thinks the url in the html is different, hence it also gives this warning:
I think this shouldn't be too hard of a fix right?