How can Opera-mini runs javascript only in the server instead the device?

[亡魂溺海] 提交于 2019-12-13 23:06:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!