mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Merge pull request #38 from gatapia/patch-3
Fix demo screenshots.html with head element contains attributes
This commit is contained in:
commit
0d24b9a734
@ -252,7 +252,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('base').attr('href',urlParts.protocol+"//"+urlParts.hostname+"/");
|
$('base').attr('href',urlParts.protocol+"//"+urlParts.hostname+"/");
|
||||||
html = html.replace("<head>","<head><base href='"+urlParts.protocol+"//"+urlParts.hostname+"/' />");
|
var base = "<base href='"+urlParts.protocol+"//"+urlParts.hostname+"/' />";
|
||||||
|
var headIdx = html.indexOf('<head');
|
||||||
|
var endHeadIdx = html.indexOf('>', headIdx);
|
||||||
|
html = html.substring(0, endHeadIdx + 1) + base + html.substring(endHeadIdx + 1);
|
||||||
if ($("#disablejs").prop('checked')){
|
if ($("#disablejs").prop('checked')){
|
||||||
html = html.replace(/\<script/gi,"<!--<script");
|
html = html.replace(/\<script/gi,"<!--<script");
|
||||||
html = html.replace(/\<\/script\>/gi,"<\/script>-->");
|
html = html.replace(/\<\/script\>/gi,"<\/script>-->");
|
||||||
|
Loading…
Reference in New Issue
Block a user