prerender.js

栏目: IT技术 · 发布时间: 4年前

内容简介:prerender.jsloads pages quickly on any browser.Prerendering loads all the assets of a page before the user navigates to that page. Conventionally, prerendering

prerender.js

prerender.js

prerender.jsloads pages quickly on any browser.

Project Features

Prerendering loads all the assets of a page before the user navigates to that page. Conventionally, prerendering is like opening the URL in a hidden tab and then showing that hidden tab once the user clicks on it.

prerender.jsis a way to preload any link the user hovers over. Based on a prerendering polyfill , it loads the next page in a hidden iframe. If that link is in a button or link element, prerender.js runs . If the user is on mobile, prerender.js runs . If the user's browser is Internet Explorer 8, prerender.js runs . prerender.js focuses on the guarantee of web performance for all users.

Data

A page on my site without prerender.js had 1.37s page load. With prerender.js that same page had a 600ms page load. A website where this is already live is under development, but you can ask me about it later when it's done.

Installers

For Node: npm i prerender_all

For the browser: <script src="https://cdn.jsdelivr.net/npm/prerender_all@1.1.0/prerender.js" integrity="sha256-24v6xZyfIpefNGAWj+r65XOkqCkF9joivvLRloIyccQ=" crossorigin="anonymous"></script>

Downloading

You can also self-host by downloading prerender.js from Github and including it in your webpage as a script. Self-hosting is as simple as that - wherever your html files are, put the code for prerender.js there too.

After you've downloaded prerender.js, copy this line of code and include it in your website:

<script src="prerender.js"></script>

Documentation

To use prerender.js with buttons, check out buttons.js in the file directory. Links do not require any configuration to enable prerender besides including the code for the script on the page.

Contributors

If you want to make the functionality for buttons better, make a pull request to the Github repo. If you think I missed something, make a pull request to this repo! I haven't been using this for a long time so I would love feedback and improvement. If you find a bug, try letting me know in the Issues tab.

Credit


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

智能

智能

[法]弗雷德里克·马特尔 / 君瑞图、左玉冰 / 商务印书馆 / 2015-8 / 59.90

揭示数字化主流大趋势的最新权威论著 《主流》作者的最新力作!与法国秋季新版同步上市! 面对数字化时代的到来,美国、欧盟、中国、俄罗斯、印度、巴西、古巴、伊朗、南非、韩国、新加坡、肯尼亚、墨西哥、日本等世界各国各地区正在如何应对? 在国际地缘政治格局下如何把握数字化主流的大趋势? 谷歌、苹果、脸书、亚马逊、阿里巴巴、腾讯、中兴、华为等大家熟知的网络巨头接受了作者的采访。作者的......一起来看看 《智能》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具