11
22
33<!-- headers
4- cross-origin-isolate
4+ cross-origin-isolate:require-corp
55-->
66
77
88< html >
99
1010 < head >
1111 < meta charset =utf-8 >
12-
12+
1313 < title >
1414 Node.js In Webpage
1515 </ title >
16-
16+
1717 < meta name =desctiption content ='Discover how to run Node.js-like code directly in the browser using WebContainers and other tools. This guide includes a live, editable demo so you can experiment with server-side JavaScript in a webpage—no local setup required. '>
1818
1919 < link rel =icon type ='image/png ' href ='/blog/image/blog-30.png '>
2222 < base href ='https://ext-code.com/blog/25-08-17/nodejs-in-webpage/ '>
2323 < link rel =canonical href ='https://ext-code.com/blog/25-08-17/nodejs-in-webpage/nodejs-in-webpage.html '>
2424
25- < script type ='application/ld+json '>
25+ < script type ='application/ld+json '>
2626 {
2727 "@context" : "https://schema.org" ,
2828 "@type" : "TechArticle" ,
3333 "dateModified" : "2025-10-29" ,
3434 "mainEntityOfPage" : { "@type" :"WebPage" , "@id" :"https://ext-code.com/blog/25-08-17/nodejs-in-webpage/nodejs-in-webpage.html" } ,
3535 "publisher" : { "@type" :"Organization" , "name" :"Your Blog or Company Name" , "logo" :{ "@type" :"ImageObject" , "url" :"https://ext-code.com/favicon.ico" } } ,
36- }
36+ }
3737 </ script >
3838<!--
3939 "image" : "https://yourdomain.com/images/http2-nodejs-demo.png"
4040-->
4141
42-
43- < script src ='https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js '> </ script >
44-
4542
43+ < script src ='https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js '> </ script >
44+
45+
4646 < script src ='https://libs.ext-code.com/js/dom/component/component.js '> </ script >
47-
47+
4848 < script init >
4949 console . clear ( ) ;
5050 console . log ( 'nodejs-in-webpage.html' ) ;
5353
5454 var df = true , version = 'v1.0'
5555 ;
56-
57-
56+
57+
5858 var ace ;
5959
6060 var ext ;
6363 var menumod ;
6464 var keydown ;
6565 var debug ;
66-
66+
6767 var menu ;
6868
6969 var hdr ;
7070 var snippet ;
7171 var log ;
7272
73-
73+
7474 //:
75-
76-
75+
76+
7777 async function init ( ) {
7878 debug ( 'init' , version ) ;
7979 menu = menumod ( ) ;
8080
8181 mod . base . add ( { ext, $, datatype, keydown, menu, menumod, ace} ) ;
8282
83-
84- hdr = mod [ 'blog-hdr' ] ;
83+
84+ hdr = mod [ 'blog-hdr' ] ;
8585 snippet = mod . ex1 ;
8686 log = mod [ 'log-mod' ] ;
8787
9797
9898
9999 initdom ( document . body ) ;
100-
101-
100+
101+
102102 } //init
103-
104-
103+
104+
105105 //:
106106
107107
110110 mod . stack . add ;
111111
112112 ( { ext} = await import ( 'https://libs.ext-code.com/js/io/ext-loader/ext-loader.m.js' ) ) ;
113-
113+
114114 var promise = ext . load . libs (
115115 'js/dom/$.js' ,
116116 'js/core/datatype.js' ,
119119 'js/debug/debug.js' ,
120120 ) ;
121121 [ $ , datatype , menumod , keydown , debug ] = await promise ;
122-
122+
123123 mod . stack . complete ;
124-
124+
125125} ) ( ) ;
126126
127-
128- </ script init>
129-
130-
131127
128+ </ script init>
129+
130+
131+
132132 < link rel =stylesheet href ='/blog/css/blog.css '>
133-
133+
134134 < style >
135135
136136 html
145145 [component ]
146146 {display : none}
147147
148- .description
148+ .description
149149 {max-width : 1000px ;text-align : justify;border-left : 4px solid # 4a90e2 ;padding : 1rem 2rem ;
150150 background-color : # f9f9f9 ;font-family : system-ui, sans-serif;font-size : 1rem ;line-height : 1.6 ;color : # 333 }
151151 .description > p
152152 {margin : 0 }
153153 .description > p + p
154154 {margin : 10px 0 }
155-
155+
156156 code
157157 {font-family : monospace;background : whitesmoke}
158158 code .inline
159159 {display : inline;padding : 5px 10px }
160-
160+
161161 a
162162 {color : # 4a90e2 ;text-decoration : none;font-weight : 500 }
163- a : hover
163+ a : hover
164164 {text-decoration : underline}
165165 .link-domain
166166 {font-size : 0.85rem ;color : # 777 ;margin-left : 0.25rem }
167- .link-domain ::before
167+ .link-domain ::before
168168 {content : '[' }
169169 .link-domain ::after
170170 {content : ']' }
171171 .link-txt
172172 {}
173-
173+
174174 input
175175 {font-size : 16px ;padding : 5px 7px ;box-sizing : border-box;}
176176 input [type = button ]
177177 {cursor : pointer}
178-
179-
178+
179+
180180
181181
182182
183183
184184 </ style >
185-
185+
186186 </ head >
187187
188188
189189 < body >
190-
191- < blog-hdr component =grp1 v2.0 >
190+
191+ < blog-hdr component =grp1 v2.0 >
192192 < h1 class =title >
193193 Node.js In Webpage
194194 </ h1 >
195195 < time slot =date datetime =2025-10-29 >
196196 29 Oct 2025
197197 </ time >
198198 </ blog-hdr >
199-
200-
199+
200+
201201 < div class =description >
202-
202+
203203 < p >
204204 running nodejs code in a webpage
205205 </ p >
@@ -211,33 +211,33 @@ <h1 class=title>
211211 < p >
212212 the containing page requires the following headers
213213 </ p >
214-
214+
215215 < p style ='font-family:monospace;white-space:pre '>
216216 cross-origin-embedder-policy : require-corp || credentialless
217217 cross-origin-opener-policy : same-origin
218218 </ p >
219-
220-
219+
220+
221221 </ div >
222-
223-
222+
223+
224224 < snippet-terminal-console id =ex1 src ='ex/ex1.js ' component > </ snippet-terminal-console >
225-
226-
225+
226+
227227 < log-mod component > </ log-mod >
228228
229229
230230 </ body >
231-
232-
231+
232+
233233<!-- ----- -->
234234
235235
236236 < script >
237-
238-
237+
238+
239239 function initdom ( rootnode ) {
240-
240+
241241 root = rootnode ;
242242
243243
@@ -246,10 +246,10 @@ <h1 class=title>
246246 snippet . initdom ( root ) ;
247247
248248 log . initdom ( ) ;
249-
250- } //initdom
251-
252-
249+
250+ } //initdom
251+
252+
253253 </ script >
254254
255255</ html >
0 commit comments