Last active
October 7, 2015 05:58
-
-
Save goranefbl/6f370cc3bef3601e3df8 to your computer and use it in GitHub Desktop.
Cookie GET example
This file contains 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( $ ) { | |
'use strict'; | |
//Javascript GET cookie parameter | |
var $_GET = {}; | |
document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () { | |
function decode(s) { | |
return decodeURIComponent(s.split("+").join(" ")); | |
} | |
$_GET[decode(arguments[1])] = decode(arguments[2]); | |
}); | |
// Get time var defined in woo backend | |
var $time = parseInt(plugin_name.timee); | |
//If raf is set, add cookie. | |
if( typeof $_GET["raf"] !== 'undefined' && $_GET["raf"] !== null ){ | |
//console.log(window.location.hostname); | |
cookie.set("gens_raf",$_GET["raf"],{ expires: $time }); | |
} | |
})( jQuery ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment