Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The iframe base64 in the generated page is too large, resulting in a blank page #188

Closed
zhang-glitch opened this issue May 9, 2024 · 2 comments

Comments

@zhang-glitch
Copy link

When downloading this website, the base64 url generated for the iframe in the pop-up section is too large, causing the pop-up section to not be displayed.
image

generated page

image

Then convert the base64 url to a blob url and you can display it directly.

const base64Url = ""
const iframe = document.querySelector('iframe');
iframe.src = base64Url // blank

// base64 url to blob url
var byteCharacters = atob(base64Url.split(',')[base64Url.split(',').length - 1]);
var byteNumbers = new Array(byteCharacters.length);
for (var i = 0; i < byteCharacters.length; i++) {
    byteNumbers[i] = byteCharacters.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
console.log(base64Url.split(',')[0].split(":")[1]);
var file = new Blob([byteArray], { type: base64Url.split(',')[0].split(":")[1] });
var fileURL = URL.createObjectURL(file);

iframe.src = fileURL // display

base64 url,blank
image
blob url , display
image

@zhang-glitch
Copy link
Author

@gildas-lormeau
Copy link
Owner

gildas-lormeau commented May 12, 2024

Thank you, I implemented an optimization where the top-level frames will use Blob URIs as source instead of data URIs when self-extracting the page. It should fix the issue you described (I was not able to test it with the URL of the website). The fix will be available in the next version of SingleFile. In order to be compliant with MV3 among other things, SingleFileZ has been merged into SingleFile and is not maintained anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants