问题
I read that Opera mini browser can run JavaScript only in server (the code isn't run in the client, it's gets it results from the server) in a newspaper.
I am writing online games and my boss want me do the same thing, but I spent hours and found nothing.
Anyone know how to do it?
回答1:
Seems that you (or your boss) misunderstood how this works. As explained here, what opera mini do is using a proxy server that executes and compress the javascript code and returns the results to the device.
Requests from the user's handset pass through the carrier's internet gateway on their way to Opera's transcoding servers. These servers then forward the request to the server.
What does this means? In a nutshell, developers just need to write their JS taking in account the limitations of Opera proxies so it can benefit from this. Other mobile browsers don't have this behavior (RIM do some optimization but I'm not sure if it's about JS) and normally, JS is mostly run by client (just think about the browser wars about who has the faster JS engine).
The server is not run by developers/users but Opera as said in the FAQ:
In more detail: When you request a page in Opera Mini, the request is sent to the Opera Mini server that then downloads the page from the Internet. The server then wraps up your page up in a neat little compressed package (we call the format OBML), ready to send back to your phone at the speed of ninjas with jetpacks.
By using Opera Mini, our servers do most of the work, so it works well with less- capable phones. Pages are often smaller (saving you money) and faster to load due our server-side compression.
来源:https://stackoverflow.com/questions/17460788/how-can-opera-mini-runs-javascript-only-in-the-server-instead-the-device