1.0.0-rc3์์ #1451๊ณผ ์ ์ฌํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. ๋ค์๊ณผ ๊ฐ์ ๋ฏธ๋์ด ์ฟผ๋ฆฌ CSS๊ฐ ์์ต๋๋ค.
<strong i="7">@media</strong> screen and (min-width: 1360px) {
...
}
<strong i="8">@media</strong> screen and (max-width: 1575px) {}
<strong i="9">@media</strong> screen and (max-width: 980px) {}
Chrome ๋ฐ Edge์์ ๋ ๋๋ง ๊ฒฐ๊ณผ๋ ์๋ฒฝํฉ๋๋ค. ๊ทธ๋ฌ๋ IE11์์๋ ๊ฒฐ๊ณผ๊ฐ ์์ ํ๋ฉด์ฒ๋ผ ๋ณด์
๋๋ค. ๋ฏธ๋์ด ์ฟผ๋ฆฌ๊ฐ ์๋ div์ ๋๋น๋ <strong i="12">@media</strong> screen and (max-width: 980px) {}
CSS์ ์ผ์นํฉ๋๋ค.
๊ทธ๋ฐ ๋ค์ https://stackoverflow.com/questions/31793507/html2canvas-renders-page-with-wrong-layout-in-ie11-whed-devtools-not-opened#comment92407156_31800273 ์ ์ง์์ ๋ฐ๋ผ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์์ ํฉ๋๋ค . //github.com/niklasvh/html2canvas/blob/master/src/dom/document-cloner.ts#L429 ์์ cloneIframeContainer.width = (bounds.width + 1).toString();
. ๊ทธ๋ฌ๋ ์ํฉ์ ๋ฐ๋์ง ์์ต๋๋ค.
๋ ํ๋์ ์ด์ํ ์ . https://stackoverflow.com/questions/31793507/html2canvas-renders-page-with-wrong-layout-in-ie11-whed-devtools-not-opened#comment92407156_31800273 ์ ์ํฉ๋ ๋์๊ฒ ์ผ์ด๋ฌ๋ค. devtools๋ฅผ ์ด๋ฉด ๋ ๋๊ฐ ์ ์๋ํฉ๋๋ค. ์ถ๊ฐ ์ฐ๊ตฌ์ ํจ๊ป. Always refresh from server
๊ตฌ์ฑ์ ์ด๋ฉด ์ ์๋ํ ์ ์์ง๋ง ๊ทธ๋ ์ง ์์ผ๋ฉด ๋ฏธ๋์ด ์ฟผ๋ฆฌ๊ฐ ์๋ชป๋๋ค๋ ๊ฒ์ ์์์ต๋๋ค.
html2canvas๋ฅผ ์ฌ์ฉํ๋ IE11์์ ๋ง๋ชจ๋ ์์ ์ด ๋ง์ด ๋ฐ์ํ ์ ์์ต๋๋ค(์ด์จ๋ ๋ด ๊ฒฝํ). ๊ฐ์ฅ ์ข์ ๋ฐฉ๋ฒ์ ์์ง๋ก ์ ๊ทธ๋ ์ด๋ํ๊ฑฐ๋ ๋ค๋ฅธ ์ต์ ๋ธ๋ผ์ฐ์ ๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ๋๋ค.
์ฌ์ค, IE11์ ์๋ ๋๋ถ๋ถ์ ๋ด ํ์ด์ง๋ h2c์ ์ ์๋ํฉ๋๋ค. ๊ทธ๋ฌ๋์ด ๋ฌธ์ ๋ ๋๋ฅผ ๋ฏธ์น๊ฒ ๋ง๋ญ๋๋ค! :(
๊ทธ ๋๋์ ์์์ :)
์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์๋ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ฐพ์์ต๋๋ค. ์ด ๋ฌธ์ ์ ๊ทผ๋ณธ ์์ธ์ ๋ฏธ๋์ด ์ฟผ๋ฆฌ CSS๊ฐ ์บ์ ์ง์ฐ๊ธฐ ํ์ ์ ์๋ํ ์ ์๊ธฐ ๋๋ฌธ์ IE์ ์บ์์ธ ๊ฒ ๊ฐ์ต๋๋ค. ๊ทธ๋์ init h2c ์ ์ CSS์ ๋ํ ๋ชจ๋ ๋งํฌ ํ๊ทธ๋ฅผ ๊ฐ์ ธ์ค๊ณ href ๋ค์ ํ์์คํฌํ๋ฅผ ์ถ๊ฐํฉ๋๋ค. ๊ฒฐ๊ณผ์ ์ผ๋ก h2c๊ฐ ์ด๋ฌํ ์ ์ ๋ฆฌ์์ค๋ฅผ ๋ค์ ๊ฐ์ ธ์ฌ ๋ ์บ์ ๋์ ์๋ฒ์์ ๊ฐ์ ธ์ต๋๋ค.
var links = document.getElementsByTagName('link');
for(var i in links){
if(links[i].href){
links[i].href = (links[i].href + "?timestamp=" + new Date().getTime());
}
}
์ ๋ ๊ฐ์ ๋ฌธ์ ๋ฅผ ๊ฒช์๋๋ฐ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ จ๋์?
@jdsxzhao
์ ๋ ์ด ๋ฌธ์ ๋ก ์ด๋ ค์์ ๊ฒช๊ณ ์์ผ๋ฉฐ ์์์ ๋ณด๊ณ ๋ ๊ฒ์ฒ๋ผ ์ด์ ์๋ฃจ์ ์ด ํ์ฌ ์ฝ๋๋ฒ ์ด์ค์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ง ๋ชปํ๋ ๊ฒ ๊ฐ์ง๋ง ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ์ฝ๋๋ฅผ ๋ฃ์ ์์น๋ฅผ ์ฐพ์์ต๋๋ค.
close() ํธ์ถ ์ ์ width + 1 ํต์ ์ํํ๋ ๋์ iframe ๋ก๋ ์ฝ์ ๋ด๋ถ์์ ๋ฐํํ๊ธฐ ์ง์ ์ ๋น์ทํ ์์ ์ ์ํํ์ต๋๋ค.
์ด์ ํด๋น ์กฐ๊ฐ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
if (documentClone.fonts && documentClone.fonts.ready) {
await documentClone.fonts.ready;
}
iframe.width = parseInt(iframe.width) + 1;
if (typeof onclone === 'function') {
return Promise.resolve()
.then(() => onclone(documentClone))
.then(() => iframe);
}
parseInt๋ ๋๋น์ 10x๋ฅผ ๊ณฑํ๋ ๋ฌธ์์ด ์ฐ๊ฒฐ๋ก ๋๋น๋ฅผ ์ค์ ํ๋ ๊ฒ์ ๋ฐฉ์งํ๊ธฐ ์ํ ๊ฒ์ ๋๋ค.
์์ง ํ๋ก๋์ ์ ์ ์ฉํ์ง ์์๊ธฐ ๋๋ฌธ์ ํ ์คํธ์์ ํฌ์ฐฉํ์ง ๋ชปํ ๋ถ์์ฉ์ด ์์ ์ ์์ง๋ง ์ง๊ธ๊น์ง๋ ์ํฉ์ด ์ ๋งํด ๋ณด์ ๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
IE11์ ์ค์ ๋ก ๋ธ๋ผ์ฐ์ ๊ฐ ์๋๋๋ค: ;)
https://www.zdnet.com/article/microsoft-security-chief-ie-is-not-a-browser-so-stop-using-it-as-your-default/
html2canvas๋ฅผ ์ฌ์ฉํ๋ IE11์์ ๋ง๋ชจ๋ ์์ ์ด ๋ง์ด ๋ฐ์ํ ์ ์์ต๋๋ค(์ด์จ๋ ๋ด ๊ฒฝํ). ๊ฐ์ฅ ์ข์ ๋ฐฉ๋ฒ์ ์์ง๋ก ์ ๊ทธ๋ ์ด๋ํ๊ฑฐ๋ ๋ค๋ฅธ ์ต์ ๋ธ๋ผ์ฐ์ ๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ๋๋ค.