nrzmalik

Storyline Vibe Code Render

Aug 25th, 2025 (edited)
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.04 KB | Source Code | 0 0
  1. var webOutput = document.querySelector("[data-acc-text='alt_text']");
  2. // Paste your HTML Code
  3. var htmlCode = ``;
  4. // HTML Code
  5. function ensureFullDoc(src) {
  6.   var hasHTML = /<\s*html[\s>]/i.test(src);
  7.   if (hasHTML) return src;
  8.   return (
  9.     '<!DOCTYPE html><html lang="en"><head>' +
  10.     '<meta charset="utf-8">' +
  11.     '<meta name="viewport" content="width=device-width,initial-scale=1">' +
  12.     '</head><body>' + src + '</body></html>'
  13.   );
  14. }
  15.  
  16. function renderHTML() {
  17.   if (!webOutput) return;
  18.  
  19.   var iframe = document.createElement('iframe');
  20.   iframe.style.width = '100%';
  21.   iframe.style.height = '100%';
  22.   iframe.style.border = '0';
  23.   iframe.style.pointerEvents = 'auto';
  24.   iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');
  25.  
  26.   webOutput.innerHTML = '';
  27.   webOutput.appendChild(iframe);
  28.  
  29.   if ('srcdoc' in iframe) {
  30.     iframe.srcdoc = ensureFullDoc(htmlCode);
  31.   } else {
  32.     var doc = iframe.contentWindow.document;
  33.     doc.open();
  34.     doc.write(ensureFullDoc(htmlCode));
  35.     doc.close();
  36.   }
  37. }
  38.  
  39. renderHTML();
  40.  
Advertisement
Add Comment
Please, Sign In to add comment