Package Data | |
---|---|
Maintainer Username: | devmatic |
Maintainer Contact: | diaafares@gmail.com (Diaa Fares) |
Package Create Date: | 2016-02-09 |
Package Last Update: | 2016-02-26 |
Home Page: | https://packagist.org/packages/devmatic/laravel-instantclick |
Language: | JavaScript |
License: | MIT |
Last Refreshed: | 2024-11-22 03:12:14 |
Package Statistics | |
---|---|
Total Downloads: | 163 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 49 |
Total Watchers: | 6 |
Total Forks: | 4 |
Total Open Issues: | 0 |
InstantClick is a plugin that makes following links in your website instant by leverages ajax to speed up the loading time of your pages.
InstantClick uses pushState and Ajax (a combo known as pjax), replacing only the body and the title in the head.
Devmatic is a web development company aims to make developers life easier. You’ll find an overview of all our projects on our website.
Your browser doesn’t have to throw and recompile scripts and styles on each page change anymore.
You don’t get a white flash while your browser is waiting for a page to display, making your website feel faster.
This package provides a middleware that can return the response that this plugin expects.
$ composer require devmatic/laravel-instantclick
\Devmatic\InstantClick\Middleware\FilterIfInstantClick
-middleware to the kernel.// app/Http/Kernel.php
...
protected $middleware = [
...
\Devmatic\InstantClick\Middleware\FilterIfInstantClick::class,
];
<script src="/path/to/instantclick.js" data-no-instant></script>
<script data-no-instant>InstantClick.init();</script>
please use the included instantclick.js file because I modify it by adding $xhr.setRequestHeader(‘X-INSTANTCLICK’, true) to give the middleware the ability to identify InstantClient requests and give the proper response to it.
The provided middleware provides the behaviour that the Instant Click plugin expects of the server:
An X-INSTANTCLICK request header is set to differentiate a InstantClick request from normal XHR requests. In this case, if the request is InstantClick, we skip the layout html and just render the inner contents of the body.
Please see CHANGELOG for more information what has changed recently.
$ composer test
Please see CONTRIBUTING for details.
The middleware in this package was originally written by Freek Van der Herten for return the response that Pjax jquery plugin expects, I edit his middleware and InstantClick plugin to make it work for Laravel. His original code can be found in this repo on GitHub.
The MIT License (MIT). Please see License File for more information.