开发者

How are we able to do programming in the browser

I'm seeing some websites coming up with awesome services of being able to do programming in browsers. This is great in my opinion for a lot of reasons. In corporate places, where a lot of things are banned from installing a web solution is brilliant. There's a interviewstreet a YC back开发者_开发技巧 startup, where you do programming interview. It's a great startup and I wonder how they manage to get compilers working in browser.


You need server hardware to handle this. I think I've only seen this for interpreted languages. They'll take what the user is programming and sandbox it from the rest of their server. One easy way of doing this is to run the language as a script inside of your program. They take a look at the code the user entered make sure there's nothing harmful inside of it and then execute it.

Some sites that I've seen this done well with are Rails for Zombies and W3Schools.

The key really is to sandbox it from the rest of your server, so they don't go off an destroy the rest of your server (vandalizing the web page and things of that sort).

The easiest way to execute programs from within another program is with eval, but it's a huge security risk as the code could do anything with your site.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜