Test
- https://harald.ist.org/paste/css_via_ajax.html
- 1<!DOCTYPE html><html lang="en" tabindex="0"><head><meta charset="UTF-8"><script>
- 2
- 3addEventListener( 'load', ()=>{
- 4 fetch( 'css_via_ajax.css' )
- 5 .then( (response)=>{
- 6 if (! response.ok) {
- 7 throw new Error( 'HTTP error, status = ' + response.status );
- 8 }
- 9 return response.text();
- 10
- 11 }).then( (new_text)=>{
- 12 const new_style_element = document.createElement( 'style' );
- 13 new_style_element.innerText = new_text;
- 14 document.head.appendChild( new_style_element );
- 15 });
- 16
- 17});
- 18
- 19</script>
- 20</head><body><p>Test</p>
- 21</body></html>
Every program ends, but not all of them halt.