mirror of
https://github.com/tcsenpai/Zundler.git
synced 2025-07-29 06:02:21 +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);
|
a.addEventListener('click', virtual_click);
|
||||||
} else if (a.getAttribute('href').startsWith('#')) {
|
} else if (a.getAttribute('href').startsWith('#')) {
|
||||||
a.setAttribute('href', "about:srcdoc" + a.getAttribute('href'))
|
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
|
// External links should open in a new tab. Browsers block links to
|
||||||
// sites of different origin within an iframe for security reasons.
|
// sites of different origin within an iframe for security reasons.
|
||||||
a.setAttribute('target', "_blank");
|
a.setAttribute('target', "_blank");
|
||||||
@ -144,6 +144,7 @@ var is_virtual = function(url) {
|
|||||||
_url.startsWith('https://') ||
|
_url.startsWith('https://') ||
|
||||||
_url.startsWith('http://') ||
|
_url.startsWith('http://') ||
|
||||||
_url.startsWith('data:') ||
|
_url.startsWith('data:') ||
|
||||||
|
_url.startsWith('about:srcdoc') ||
|
||||||
_url.startsWith('blob:')
|
_url.startsWith('blob:')
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
@ -38,6 +38,12 @@ var load_virtual_page = (function (path, get_params, anchor) {
|
|||||||
const file = window.global_context.file_tree[path];
|
const file = window.global_context.file_tree[path];
|
||||||
var iframe = createIframe();
|
var iframe = createIframe();
|
||||||
|
|
||||||
|
if (!file) {
|
||||||
|
console.error("File not found:", path, get_params, anchor);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const data = file.data;
|
const data = file.data;
|
||||||
window.global_context.get_parameters = get_params;
|
window.global_context.get_parameters = get_params;
|
||||||
if (file.mime_type == 'text/html') {
|
if (file.mime_type == 'text/html') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user