Skip to content

Instantly share code, notes, and snippets.

Avatar
🤪
NEVERWINTER

Jason Nixathor xubmuajkub

🤪
NEVERWINTER
View GitHub Profile
@ikawka
ikawka / cloudflare-trace.js
Last active February 2, 2023 03:48
Trace current user's location via javascript with CloudFlare provided the /cdn-cgi/trace is enabled.
View cloudflare-trace.js
(function($){
$(function(){
$.ajax({
contentType: 'application/text; charset=utf-8',
crossBrowser: true,
type: 'GET',
url: '/cdn-cgi/trace',
}).done(function(d){
var data = d.replace(/[\r\n]+/g, '","').replace(/\=+/g, '":"');
data = '{"' + data.slice(0, data.lastIndexOf('","')) + '"}';