mirror of
https://github.com/tcsenpai/Zundler.git
synced 2025-06-06 11:35:40 +00:00
Fix error with about:srcdoc links; add extra check
This commit is contained in:
parent
0c4bbe69a3
commit
c24f30f5ec
@ -91,7 +91,7 @@ var fix_link = function(a) {
|
||||
a.addEventListener('click', virtual_click);
|
||||
} else if (a.getAttribute('href').startsWith('#')) {
|
||||
a.setAttribute('href', "about:srcdoc" + a.getAttribute('href'))
|
||||
} else {
|
||||
} else if (!a.getAttribute('href').startsWith('about:srcdoc')) {
|
||||
// External links should open in a new tab. Browsers block links to
|
||||
// sites of different origin within an iframe for security reasons.
|
||||
a.setAttribute('target', "_blank");
|
||||
@ -144,6 +144,7 @@ var is_virtual = function(url) {
|
||||
_url.startsWith('https://') ||
|
||||
_url.startsWith('http://') ||
|
||||
_url.startsWith('data:') ||
|
||||
_url.startsWith('about:srcdoc') ||
|
||||
_url.startsWith('blob:')
|
||||
));
|
||||
};
|
||||
|
@ -38,6 +38,12 @@ var load_virtual_page = (function (path, get_params, anchor) {
|
||||
const file = window.global_context.file_tree[path];
|
||||
var iframe = createIframe();
|
||||
|
||||
if (!file) {
|
||||
console.error("File not found:", path, get_params, anchor);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const data = file.data;
|
||||
window.global_context.get_parameters = get_params;
|
||||
if (file.mime_type == 'text/html') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user