Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

prerender-mobile-useragent

obiyuta5MIT1.0.0

Prerender plugin that enables you to create snapshots that prepared for mobile devices(iPhone, Android...).

prerender, plugin, useragent, mobile

readme

prerender-mobile-useragent npm version

Prerender plugin that enables you to create snapshots that prepared for mobile devices(iPhone, Android...).

How it works

Prerender creates snapshots with PhantomJS useragent (like the following) even if the original request is from mobiles.

PhantomJS/x.x.x ...

If you prepare pages, layouts or styles for mobiles depends on those useragent, you have to request with mobile useragent.

So this plugin adds 'iPhone'(default) to the Phantom's useragent when the original request is from mobile devices or bot.

PhantomJS/x.x.x ... iPhone

Requirement

  • Prerender >= 4.0.2

Usage

In your local prerender project run:

$ npm install prerender-mobile-useragent --save

Then in the server.js that initializes the prerender:

server.use(require('prerender-mobile-useragent'));

Using External Configuration

You can use the enviroment variable MOBILE_USER_AGENT

export MOBILE_USER_AGENT=mobile-useragent
# default is 'iPhone'

changelog

Change Log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

1.0.0 - 2016-07-11

Changed

  • Support prerender version 4.0.2 and above