Skip to content

Instantly share code, notes, and snippets.

View xubmuajkub's full-sized avatar

Jason Nixathor xubmuajkub

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