5 ms·
No live demo? or did i skim too badly :) ?
by anotheryou 6y ago
No live demo? or did i skim too badly :) ?
- zingplex 6y agoThat's a shame. I was interested in seeing how different browser engines handled it.
- banana_giraffe 6y agoI wanted to see it locally, so I threw this together: #!/usr/bin/env python3 from flask import Flask app = Flask(__name__) @app.route('/') def hello(): return world("0") @app.route('/<depth>') def world(depth): return f""" <head><title>iframe loop</title></head> <body><h1>iframe loop</h1> <iframe width="800" height="600" src="/{int(depth)+1}"></iframe> </body></html> """ if __name__ == '__main__': app.run() I put the Chrome tab out of it's misery after 250 frames, it was really chugging along.
- thitcanh 6y agoAs a JavaScript developer I feel kinda sad when I see how compact and clean such python and ruby examples are. You can shoot a thousand modules in JS and you still never get here.
- woutr_be 6y agoThe by default included http module would let you achieve the same thing. Might be a few lines more, but definitely not 1000 modules more.
- woutr_be 6y agoSimilar example in Node const http = require('http'); const url = require('url'); http.createServer((req, res) => { const queryObject = url.parse(req.url, true).query; return res.writeHead(200, { 'contentType': 'text/html' }).end(world(queryObject.depth)); }).listen(8080); function world(depth = 0) { return ` <head><title>iframe loop</title></head> <body><h1>iframe loop ${depth}</h1> <iframe width="800" height="600" src="/?depth=${parseInt(depth)+1}"></iframe> </body></html> `; }
- deleted 6y ago[deleted]
- deleted 6y ago[deleted]