One page only javascript applications

前端 未结 8 947
野性不改
野性不改 2021-02-08 23:09

Have you experimented with single page web application, i.e. where the browser only \'GETs\' one page form the server, the rest being handled by client side javascript code (one

8条回答
  •  没有蜡笔的小新
    2021-02-08 23:56

    I was creating exactly these kind of pages as webapps for the iPhone. My method was to really put everything in one huge index.html file and to hide or show certain content. This showing and hiding i.e. the navigation of the page, I control in a special javascript file where the necessary functions for handling the display of the parts in the page are.

    Pro: Everything is loaded in the beginning and you don't need to request anything from the server anymore, e.g. "switching" content and performing actions is very fast.

    Con: First, everything has to load... that can take its time, if you have a lot of content that has to be shown immediately.

    Another issue is that in case when the connection goes down, the user will not really notice until he actually needs the server side. You can notice that in Gmail as well. (It sometimes can be a positive thing though).

    Hope it helps! greets

提交回复
热议问题