Der Blob-Link funktioniert nicht im Iframe-HTML-Inhalt in der lokalen Datei [Duplikat]JavaScript

Javascript-Forum
Anonymous
 Der Blob-Link funktioniert nicht im Iframe-HTML-Inhalt in der lokalen Datei [Duplikat]

Post by Anonymous »

Code: Select all

let url = (content, type) =>
URL.createObjectURL (
new Blob ([content], {type}));

let cssUrl = url ('#d1 { color: green; }',
'text/css');
let htmlUrl = url (`

Div`, 'text/html');

ifr.src = htmlUrl;
log.textContent = cssUrl;

Code: Select all




Dieser Code funktioniert gut in jsfiddle
cssUrl ist etwa so: blob:https://fiddle.jshell.net/2dacb344-cec1 ... 93a2680922
Aber nicht als lokale Datei (CSS wird nicht angewendet, obwohl der Inhalt gut angezeigt wird) beim Öffnen im Browser (ohne Server) oder im Stackoverflow.
In diesem Fall sieht cssUrl so aus: blob:null/37686c99-658b-4c13-883d-3f0a3fc4937b
Wie kann ich das beheben, damit es in der lokalen Datei funktioniert?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post