Created
November 7, 2014 04:04
-
-
Save ksomemo/e32e7a2d60f6f7f2f3ba to your computer and use it in GitHub Desktop.
Webビーコン Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var action_target = document.createElement('img'); | |
action_target.width = 1; | |
action_target.height = 1; | |
action_target.alt = ""; | |
action_target.src = '/api/action'; | |
document.body.appendChild(action_target); | |
console.log("action"); | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// using laravel | |
class ActionController extends BaseController | |
{ | |
public function getIndex() | |
{ | |
$expires = gmdate('r', time('1970-01-01 00:00:00')); | |
$headers = [ | |
'Cache-Control' => 'private, no-cache, must-revalidate', | |
'Expires' => $expires, | |
'Pragma' => 'no-cache', | |
'Content-Length' => 1, | |
'Content-Type' => 'image/gif' | |
]; | |
$onePixelGif = base64_decode("R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw%3D%3D"); | |
return Response::make($onePixelGif, 200, $headers); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment