Canvas .fillText not working after the first time - javascript

I'm using jCaptcha.js to generate captcha for my application. It works perfectly for the first time once I'm done with the signup & logout & try to signup new acc. the canvas doesn't print anything it shows blank & because of it, it goes in a loop cos I setup a check to see if it comes blank.
if ($('.jCaptchaText')[0].toDataURL() != $('#blankCaptcha')[0].toDataURL())
isCaptchaBlank = false;
jCaptcha.js
! function(t, a) {
"function" == typeof define && define.amd ? define([], function() {
return t.jCaptcha = a()
}) : "object" == typeof module && module.exports ? module.exports = a() : t.jCaptcha = a()
}(this, function() {
var t = function(t, a) {
return "function" != typeof NodeList.prototype.forEach && (NodeList.prototype.forEach = Array.prototype.forEach), Object.keys(a).forEach(function(e) {
t[e] = a[e]
}), t
},
a = function() {
n = Math.round(8 * Math.random()) + 1, c = Math.round(8 * Math.random()) + 1, i = n + c
},
e = function(t, a, e) {
!e && t[0].insertAdjacentHTML("beforebegin", '<canvas class="jCaptchaText"></canvas>'), this.$captchaText = this.$captchaText || document.getElementsByClassName("jCaptchaText"), this.$jCaptchaTextContext = this.$jCaptchaTextContext || this.$captchaText[0].getContext("2d"), this.$captchaText[0].width = a.canvasWidth, this.$captchaText[0].height = a.canvasHeight, this.$jCaptchaTextContext.textBaseline = "top", this.$jCaptchaTextContext.font = a.canvasFontSize + " " + a.canvasFontFamily, this.$jCaptchaTextContext.textAlign = "left", this.$jCaptchaTextContext.fillStyle = a.canvasFillStyle, this.$jCaptchaTextContext.fillText(n + " + " + c + " " + a.requiredValue, 0, 0)
},
i = void 0,
n = void 0,
c = void 0,
o = function(a) {
this.options = a ? t(this.options, a) : this.options, this.init()
};
return o.prototype = {
options: {
el: "jCaptcha",
requiredValue: "=",// vinaya20180820 - made required value text as "=". it was * originally.
resetOnError: !0,
focusOnError: !0,
clearOnSubmit: !0,
canvasWidth: 50,
canvasHeight: 15,
canvasFontSize: "15px",
canvasFontFamily: "Arial",
canvasFillStyle: "#fff",
callback: null
},
init: function() {
this.$captchaInput = document.getElementsByClassName(this.options.el), a(), e(this.$captchaInput, this.options)
},
validate: function() {
this.callbackReceived = this.callbackReceived || "function" == typeof this.options.callback, this.$captchaInput[0].value != i ? (this.callbackReceived && this.options.callback("error", this.$captchaInput), !0 === this.options.resetOnError && this.reset(), !0 === this.options.focusOnError && this.$captchaInput[0].focus(), !0 === this.options.clearOnSubmit && (this.$captchaInput[0].value = "")) : (this.callbackReceived && this.options.callback("success", this.$captchaInput), !0 === this.options.clearOnSubmit && (this.$captchaInput[0].value = ""))
},
reset: function() {
a(), e(this.$captchaInput, this.options, !0)
}
}, o
});

I just added a location.reload(true) when I redirect to login page again(where the captcha is initialized). This worked for me. Don't know if it has some cache issue or something with .filltext but reload seems to fix it. Please let me know if there is better solution.

Related

Azure Application Insights not logging unhandled browser events or exceptions

I'm attempting to log unhandled browser exceptions in an ASP.NET Core web application. I'm following the setup documentation noted here on learn.microsoft.com. I'm not currently seeing anything being logged, even if I manually call appInsights.trackException(ex). It should be noted that I am able to see logs that are coming from the backend code, just not anything from the client's browser.
While I can't post the code directly related to the project I'm working on, I've created a small web page that I can run locally just to recreate the issue.
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
!function (T, l, y) { var S = T.location, k = "script", D = "instrumentationKey", C = "ingestionendpoint", I = "disableExceptionTracking", E = "ai.device.", b = "toLowerCase", w = "crossOrigin", N = "POST", e = "appInsightsSDK", t = y.name || "appInsights"; (y.name || T[e]) && (T[e] = t); var n = T[t] || function (d) { var g = !1, f = !1, m = { initialize: !0, queue: [], sv: "5", version: 2, config: d }; function v(e, t) { var n = {}, a = "Browser"; return n[E + "id"] = a[b](), n[E + "type"] = a, n["ai.operation.name"] = S && S.pathname || "_unknown_", n["ai.internal.sdkVersion"] = "javascript:snippet_" + (m.sv || m.version), { time: function () { var e = new Date; function t(e) { var t = "" + e; return 1 === t.length && (t = "0" + t), t } return e.getUTCFullYear() + "-" + t(1 + e.getUTCMonth()) + "-" + t(e.getUTCDate()) + "T" + t(e.getUTCHours()) + ":" + t(e.getUTCMinutes()) + ":" + t(e.getUTCSeconds()) + "." + ((e.getUTCMilliseconds() / 1e3).toFixed(3) + "").slice(2, 5) + "Z" }(), iKey: e, name: "Microsoft.ApplicationInsights." + e.replace(/-/g, "") + "." + t, sampleRate: 100, tags: n, data: { baseData: { ver: 2 } } } } var h = d.url || y.src; if (h) { function a(e) { var t, n, a, i, r, o, s, c, u, p, l; g = !0, m.queue = [], f || (f = !0, t = h, s = function () { var e = {}, t = d.connectionString; if (t) for (var n = t.split(";"), a = 0; a < n.length; a++) { var i = n[a].split("="); 2 === i.length && (e[i[0][b]()] = i[1]) } if (!e[C]) { var r = e.endpointsuffix, o = r ? e.location : null; e[C] = "https://" + (o ? o + "." : "") + "dc." + (r || "services.visualstudio.com") } return e }(), c = s[D] || d[D] || "", u = s[C], p = u ? u + "/v2/track" : d.endpointUrl, (l = []).push((n = "SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details)", a = t, i = p, (o = (r = v(c, "Exception")).data).baseType = "ExceptionData", o.baseData.exceptions = [{ typeName: "SDKLoadFailed", message: n.replace(/\./g, "-"), hasFullStack: !1, stack: n + "\nSnippet failed to load [" + a + "] -- Telemetry is disabled\nHelp Link: https://go.microsoft.com/fwlink/?linkid=2128109\nHost: " + (S && S.pathname || "_unknown_") + "\nEndpoint: " + i, parsedStack: [] }], r)), l.push(function (e, t, n, a) { var i = v(c, "Message"), r = i.data; r.baseType = "MessageData"; var o = r.baseData; return o.message = 'AI (Internal): 99 message:"' + ("SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details) (" + n + ")").replace(/\"/g, "") + '"', o.properties = { endpoint: a }, i }(0, 0, t, p)), function (e, t) { if (JSON) { var n = T.fetch; if (n && !y.useXhr) n(t, { method: N, body: JSON.stringify(e), mode: "cors" }); else if (XMLHttpRequest) { var a = new XMLHttpRequest; a.open(N, t), a.setRequestHeader("Content-type", "application/json"), a.send(JSON.stringify(e)) } } }(l, p)) } function i(e, t) { f || setTimeout(function () { !t && m.core || a() }, 500) } var e = function () { var n = l.createElement(k); n.src = h; var e = y[w]; return !e && "" !== e || "undefined" == n[w] || (n[w] = e), n.onload = i, n.onerror = a, n.onreadystatechange = function (e, t) { "loaded" !== n.readyState && "complete" !== n.readyState || i(0, t) }, n }(); y.ld < 0 ? l.getElementsByTagName("head")[0].appendChild(e) : setTimeout(function () { l.getElementsByTagName(k)[0].parentNode.appendChild(e) }, y.ld || 0) } try { m.cookie = l.cookie } catch (p) { } function t(e) { for (; e.length;)!function (t) { m[t] = function () { var e = arguments; g || m.queue.push(function () { m[t].apply(m, e) }) } }(e.pop()) } var n = "track", r = "TrackPage", o = "TrackEvent"; t([n + "Event", n + "PageView", n + "Exception", n + "Trace", n + "DependencyData", n + "Metric", n + "PageViewPerformance", "start" + r, "stop" + r, "start" + o, "stop" + o, "addTelemetryInitializer", "setAuthenticatedUserContext", "clearAuthenticatedUserContext", "flush"]), m.SeverityLevel = { Verbose: 0, Information: 1, Warning: 2, Error: 3, Critical: 4 }; var s = (d.extensionConfig || {}).ApplicationInsightsAnalytics || {}; if (!0 !== d[I] && !0 !== s[I]) { var c = "onerror"; t(["_" + c]); var u = T[c]; T[c] = function (e, t, n, a, i) { var r = u && u(e, t, n, a, i); return !0 !== r && m["_" + c]({ message: e, url: t, lineNumber: n, columnNumber: a, error: i }), r }, d.autoExceptionInstrumented = !0 } return m }(y.cfg); function a() { y.onInit && y.onInit(n) } (T[t] = n).queue && 0 === n.queue.length ? (n.queue.push(a), n.trackPageView({})) : a() }(window, document, {
src: "https://js.monitor.azure.com/scripts/b/ai.2.min.js", // The SDK URL Source
// name: "appInsights", // Global SDK Instance name defaults to "appInsights" when not supplied
// ld: 0, // Defines the load delay (in ms) before attempting to load the sdk. -1 = block page load and add to head. (default) = 0ms load after timeout,
// useXhr: 1, // Use XHR instead of fetch to report failures (if available),
crossOrigin: "anonymous", // When supplied this will add the provided value as the cross origin attribute on the script tag
// onInit: null, // Once the application insights instance has loaded and initialized this callback function will be called with 1 argument -- the sdk instance (DO NOT ADD anything to the sdk.queue -- As they won't get called)
cfg: { // Application Insights Configuration
instrumentationKey: "myInstrumentationKey"
}
});
</script>
<script>
console.log(appInsights); // this produces an output, so appInsights is at least created
try {
x.hello; // x is not defined, this throws an exception
} catch (ex) {
appInsights.trackException(ex); // attempting to log exception manually
appInsights.flush();
throw ex; // attempting to log unhandled exception
}
</script>
</head>
</html>
In this code, I initialize everything using the snippet provided in the link above. I try to call x.hello, but x isn't defined so any exception is thrown. I then attempt to log that exception manually using appInsights.trackException(ex) and I also re-throw the exception because, according to the link above, unhandled browser exceptions should be logged automatically. I am however not seeing either of these events appear in application insights.
I know my instrumentation key is correct, because an incorrect one would yield some 400 errors when attempting to connect. This is what my network tab looks like after connecting.
Any ideas where I'm going wrong here?
I am following the same snippet which you are used.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
!function (T, l, y) { var S = T.location, k = "script", D = "instrumentationKey", C = "ingestionendpoint", I = "disableExceptionTracking", E = "ai.device.", b = "toLowerCase", w = "crossOrigin", N = "POST", e = "appInsightsSDK", t = y.name || "appInsights"; (y.name || T[e]) && (T[e] = t); var n = T[t] || function (d) { var g = !1, f = !1, m = { initialize: !0, queue: [], sv: "5", version: 2, config: d }; function v(e, t) { var n = {}, a = "Browser"; return n[E + "id"] = a[b](), n[E + "type"] = a, n["ai.operation.name"] = S && S.pathname || "_unknown_", n["ai.internal.sdkVersion"] = "javascript:snippet_" + (m.sv || m.version), { time: function () { var e = new Date; function t(e) { var t = "" + e; return 1 === t.length && (t = "0" + t), t } return e.getUTCFullYear() + "-" + t(1 + e.getUTCMonth()) + "-" + t(e.getUTCDate()) + "T" + t(e.getUTCHours()) + ":" + t(e.getUTCMinutes()) + ":" + t(e.getUTCSeconds()) + "." + ((e.getUTCMilliseconds() / 1e3).toFixed(3) + "").slice(2, 5) + "Z" }(), iKey: e, name: "Microsoft.ApplicationInsights." + e.replace(/-/g, "") + "." + t, sampleRate: 100, tags: n, data: { baseData: { ver: 2 } } } } var h = d.url || y.src; if (h) { function a(e) { var t, n, a, i, r, o, s, c, u, p, l; g = !0, m.queue = [], f || (f = !0, t = h, s = function () { var e = {}, t = d.connectionString; if (t) for (var n = t.split(";"), a = 0; a < n.length; a++) { var i = n[a].split("="); 2 === i.length && (e[i[0][b]()] = i[1]) } if (!e[C]) { var r = e.endpointsuffix, o = r ? e.location : null; e[C] = "https://" + (o ? o + "." : "") + "dc." + (r || "services.visualstudio.com") } return e }(), c = s[D] || d[D] || "", u = s[C], p = u ? u + "/v2/track" : d.endpointUrl, (l = []).push((n = "SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details)", a = t, i = p, (o = (r = v(c, "Exception")).data).baseType = "ExceptionData", o.baseData.exceptions = [{ typeName: "SDKLoadFailed", message: n.replace(/\./g, "-"), hasFullStack: !1, stack: n + "\nSnippet failed to load [" + a + "] -- Telemetry is disabled\nHelp Link: https://go.microsoft.com/fwlink/?linkid=2128109\nHost: " + (S && S.pathname || "_unknown_") + "\nEndpoint: " + i, parsedStack: [] }], r)), l.push(function (e, t, n, a) { var i = v(c, "Message"), r = i.data; r.baseType = "MessageData"; var o = r.baseData; return o.message = 'AI (Internal): 99 message:"' + ("SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details) (" + n + ")").replace(/\"/g, "") + '"', o.properties = { endpoint: a }, i }(0, 0, t, p)), function (e, t) { if (JSON) { var n = T.fetch; if (n && !y.useXhr) n(t, { method: N, body: JSON.stringify(e), mode: "cors" }); else if (XMLHttpRequest) { var a = new XMLHttpRequest; a.open(N, t), a.setRequestHeader("Content-type", "application/json"), a.send(JSON.stringify(e)) } } }(l, p)) } function i(e, t) { f || setTimeout(function () { !t && m.core || a() }, 500) } var e = function () { var n = l.createElement(k); n.src = h; var e = y[w]; return !e && "" !== e || "undefined" == n[w] || (n[w] = e), n.onload = i, n.onerror = a, n.onreadystatechange = function (e, t) { "loaded" !== n.readyState && "complete" !== n.readyState || i(0, t) }, n }(); y.ld < 0 ? l.getElementsByTagName("head")[0].appendChild(e) : setTimeout(function () { l.getElementsByTagName(k)[0].parentNode.appendChild(e) }, y.ld || 0) } try { m.cookie = l.cookie } catch (p) { } function t(e) { for (; e.length;)!function (t) { m[t] = function () { var e = arguments; g || m.queue.push(function () { m[t].apply(m, e) }) } }(e.pop()) } var n = "track", r = "TrackPage", o = "TrackEvent"; t([n + "Event", n + "PageView", n + "Exception", n + "Trace", n + "DependencyData", n + "Metric", n + "PageViewPerformance", "start" + r, "stop" + r, "start" + o, "stop" + o, "addTelemetryInitializer", "setAuthenticatedUserContext", "clearAuthenticatedUserContext", "flush"]), m.SeverityLevel = { Verbose: 0, Information: 1, Warning: 2, Error: 3, Critical: 4 }; var s = (d.extensionConfig || {}).ApplicationInsightsAnalytics || {}; if (!0 !== d[I] && !0 !== s[I]) { var c = "onerror"; t(["_" + c]); var u = T[c]; T[c] = function (e, t, n, a, i) { var r = u && u(e, t, n, a, i); return !0 !== r && m["_" + c]({ message: e, url: t, lineNumber: n, columnNumber: a, error: i }), r }, d.autoExceptionInstrumented = !0 } return m }(y.cfg); function a() { y.onInit && y.onInit(n) } (T[t] = n).queue && 0 === n.queue.length ? (n.queue.push(a), n.trackPageView({})) : a() }(window, document, {
src: "https://js.monitor.azure.com/scripts/b/ai.2.min.js", // The SDK URL Source
// name: "appInsights", // Global SDK Instance name defaults to "appInsights" when not supplied
// ld: 0, // Defines the load delay (in ms) before attempting to load the sdk. -1 = block page load and add to head. (default) = 0ms load after timeout,
// useXhr: 1, // Use XHR instead of fetch to report failures (if available),
crossOrigin: "anonymous", // When supplied this will add the provided value as the cross origin attribute on the script tag
// onInit: null, // Once the application insights instance has loaded and initialized this callback function will be called with 1 argument -- the sdk instance (DO NOT ADD anything to the sdk.queue -- As they won't get called)
cfg: { // Application Insights Configuration
instrumentationKey: "Your Instrumentation key"
/* ...Other Configuration Options... */
}
});
</script>
<script>
//function getCookieValue(key) {
// const cookie = document.cookie
// .split('; ')
// .find(cookie => cookie.startsWith(key));
// return cookie ? cookie.split('=')[1] : null;
//}
//var telemetryInitializer = (envelope) => {
// const environment = getCookieValue('x-ms-routing-name') || 'production';
// envelope.data['slot'] = environment;
//}
//appInsights.addTelemetryInitializer(telemetryInitializer);
console.log(appInsights); // this produces an output, so appInsights is at least created
try {
s.hello; // x is not defined, this throws an exception
} catch (ex) {
//appInsights.trackException(ex); // attempting to log exception manually
appInsights.flush();
throw ex; // attempting to log unhandled exception
}
</script>
</head>
Without adding the appInsights.trackException(ex); I am able to see the uncaught ReferenceError in application insights.
Refer here for more info

How can I get full string of my JavaScript UMD package in window environment? `.toString()` is not working

I have a UMD bundle of my package called utils, it only has one method called sum like this:
<script src="path/to/my/utils-umd.js"></script>
<script>
console.log(utils.sum([1,2,3]));
// => 6
</script>
Now, I want to get the full string of my UMD source code, I can't simply fetch('path/to/my/utils-umd.js') for some reason, so I need to synchronously get my UMD bundle string.
I have tried several things, but no luck, here are some of them:
window.utils.toString();
// => "[object Module]"
Object.prototype.toString.call(window.utils);
// => "[object Module]"
typeof window.utils;
// => "object"
JSON.stringify(window.utils)
// => "{}"
Here is my full UMD bundle source code:
(function(e, t) {
'object' === typeof exports && 'object' === typeof module
? (module.exports = t())
: 'function' === typeof define && define.amd
? define([], t)
: 'object' === typeof exports
? (exports['utils'] = t())
: (e['utils'] = t());
})('undefined' !== typeof self ? self : this, function() {
return (function(e) {
var t = {};
function n(r) {
if (t[r]) return t[r].exports;
var o = (t[r] = { i: r, l: !1, exports: {} });
return e[r].call(o.exports, o, o.exports, n), (o.l = !0), o.exports;
}
return (
(n.m = e),
(n.c = t),
(n.d = function(e, t, r) {
n.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: r });
}),
(n.r = function(e) {
'undefined' !== typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(e, '__esModule', { value: !0 });
}),
(n.t = function(e, t) {
if ((1 & t && (e = n(e)), 8 & t)) return e;
if (4 & t && 'object' === typeof e && e && e.__esModule) return e;
var r = Object.create(null);
if (
(n.r(r),
Object.defineProperty(r, 'default', { enumerable: !0, value: e }),
2 & t && 'string' != typeof e)
)
for (var o in e)
n.d(
r,
o,
function(t) {
return e[t];
}.bind(null, o)
);
return r;
}),
(n.n = function(e) {
var t =
e && e.__esModule
? function() {
return e['default'];
}
: function() {
return e;
};
return n.d(t, 'a', t), t;
}),
(n.o = function(e, t) {
return Object.prototype.hasOwnProperty.call(e, t);
}),
(n.p = ''),
n((n.s = 'fae3'))
);
})({
f6fd: function(e, t) {
(function(e) {
var t = 'currentScript',
n = e.getElementsByTagName('script');
t in e ||
Object.defineProperty(e, t, {
get: function() {
try {
throw new Error();
} catch (r) {
var e,
t = (/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(r.stack) || [!1])[1];
for (e in n)
if (n[e].src == t || 'interactive' == n[e].readyState)
return n[e];
return null;
}
}
});
})(document);
},
fae3: function(e, t, n) {
'use strict';
var r;
(n.r(t), 'undefined' !== typeof window) &&
(n('f6fd'),
(r = window.document.currentScript) &&
(r = r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)) &&
(n.p = r[1]));
function o(e) {
return e.reduce(function(e, t) {
return e + t;
}, 0);
}
n.d(t, 'sum', function() {
return o;
});
}
});
});
//# sourceMappingURL=utils.umd.min.js.map
Is it possible to do this?
You can only get the source code of a function using toString method you can try and make all the UMD bundle to run in a function with a name then you will be able to get the source code using toString for example:
function foo() {
console.log('foo')
return true;
}
document.getElementById('res').innerText = foo.toString();
<div id="res">
aaaaaaaaaa
</div>
I can't simply fetch('path/to/my/utils-umd.js') for some reason
If you can load a script via <script src='?'>, then I can see no reason why fetch wouldn't work.
Below is an example that loads jquery into a textarea using fetch..
const jqueryurl = 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js';
async function getjquerySrc() {
document.querySelector('textarea').value =
await(await fetch(jqueryurl)).text();
}
getjquerySrc();
textarea {
width: 100%;
}
<textarea rows=10>
</textarea>
Using XMLHttpRequest I get JS file to string I hope it should help you.
<script src="utils-umd.js"></script>
<script>
var client = new XMLHttpRequest();
client.open('GET', 'utils-umd.js');
client.onreadystatechange = function() {
console.log(client.responseText);
}
client.send();
</script>

Redirect on JQuery between other functions

How do I redirect to any page after the script below got sucess?
Something like: If the code below did everything right, I need to go to the thanks page. Please help me. Thanks
jQuery(function(t) {
var e = function() {
var e = ("https:" == location.protocol ? "https:" : "http:") + "//formoid.net/api/push",
a = function() {
var e = (/MSIE (\d+)\./.exec(navigator.userAgent) || [0, 0])[1]
return 8 == e || 9 == e && "file:" != location.protocol ? function(e, a) {
var n = new XDomainRequest,
r = t.Deferred()
return n.open(a.type, e), n.onload = function() {
r.resolve(this.responseText)
}, n.onerror = function() {
r.reject()
}, n.send(a.data), r
} : (t.support.cors = !0, t.ajax)
}(),
n = function(t, e) {
return t = "__" + t + "__", e.length ? (this[t] = e[0], this) : this[t]
},
r = function(e, a, n) {
return t.each(n, function(t, n) {
e[n] = function() {
return a[n].apply(a, arguments)
}
}), e
},
i = function(t) {
t = t || {}, this.__email__ = t.email || "", this.__title__ = t.title || "", this.__data__ = t.data || []
}
return i.prototype.email = function(t) {
return n.call(this, "email", arguments)
}, i.prototype.title = function(t) {
return n.call(this, "title", arguments)
}, i.prototype.data = function(t) {
return n.call(this, "data", arguments)
}, i.prototype.send = function(n, i) {
var o = r(t.Deferred(), this, ["email", "title", "data", "send"])
return i && (i.call(this, o), "pending" != o.state()) ? o : (a(e, {
type: "POST",
data: JSON.stringify({
email: this.__email__,
form: {
title: this.__title__,
data: arguments.length ? n : this.__data__
}
})
}).done(function(t) {
try {
var e = JSON.parse(t)
e.error ? o.reject(e.error) : o.resolve(e.response)
} catch (a) {
o.reject("Incorrect server response.")
}
}).fail(function() {
var t = "Failed to query the server. "
t += "onLine" in navigator && !navigator.onLine ? "No connection to the Internet." : "Check the connection and try again.", o.reject(t)
}), o)
}, {
Form: function(t) {
return new i(t)
}
}
}(),
a = function(e) {
if (e.checkValidity) return e.checkValidity()
var a = !0,
n = t(e).val(),
r = t(e).attr("type")
return n ? a = !("email" === r && !/^([^#]+?)#(([a-z0-9]-*)*[a-z0-9]+\.)+([a-z0-9]+)$/i.test(n)) : t(e).attr("required") && (a = !1), t(e)[(a ? "remove" : "add") + "Class"]("form-invalid"), a
}
t('[data-form-type="formoid"]').each(function() {
var n, r = t(this),
i = r.is("form") ? r : r.find("form"),
o = r.find("[data-form-alert]"),
s = r.is("[data-form-title]") ? r : r.find("[data-form-title]"),
l = r.find('[type="submit"]'),
c = o.attr("data-success") || o.find("[data-form-alert-success]").html()
l.html('<span class="btn-text">' + l.html() + '</span><i class="btn-loader"></i>').click(function() {
i.addClass("form-active")
}), i.submit(function(d) {
if (d.preventDefault(), i.addClass("form-active"), !l.hasClass("btn-loading")) {
var f = !0,
u = []
n = n || e.Form({
email: r.find("[data-form-email]").val(),
title: s.attr("data-form-title") || s.text()
}), o.html(""), r.find("[data-form-field]").each(function() {
a(this) || (f = !1), u.push([t(this).attr("data-form-field") || t(this).attr("name"), t(this).val()])
}), f && (l.addClass("btn-loading").prop("disabled", !0), n.send(u).done(function(e) {
i.removeClass("form-active"), r.find("[data-form-field]").val(""), o.append(t('<div class="alert alert-form alert-success text-xs-center"/>').text(c || e))
}).fail(function(e) {
o.append(t('<div class="alert alert-form alert-danger text-xs-center"/>').text(e))
}).always(function() {
l.removeClass("btn-loading").prop("disabled", !1)
}))
}
})
})
})
Everything works fine but in the end I want to redirect to a page right after the form data has been sent. Can you help me? Thanks
Bind an event to the submit of the form, if you have one, or run a callback after a successful response comes back from the server and use window.location to send the user to your desired URL. More information on window.location can be found here: https://developer.mozilla.org/en-US/docs/Web/API/Window/location. (Look at the example #1)
I can't say more than that from the code you shared.

What is nio.js?

I am seeing an unknown script being displayed on all pages hosted on my site. This was not added by me to any of the pages, so i am assuming the hosting company is adding it on the fly when a page is requested.
This is what is added to the the page
<script>
! function(n, e, i, o, t) {
'use strict';
if (!n.nio) {
n.nio = function() {
n.nio.execAction ? n.nio.execAction.apply(window.nio, arguments) : n.nio.queue.push(arguments)
}, n.nio.push = n.nio, n.nio.loaded = !0, n.nio.version = '1.0', n.nio.queue = [];
var s = e.createElement(i);
s.async = !0, s.src = o;
var r = e.getElementsByTagName(i)[0];
r.parentNode.insertBefore(s, r)
}
}(window, document, 'script', '//cdn.narrative.io/js/nio-js/v1.1/nio.js');
nio('init', 9);
</script>
<noscript><img height='1' width='1' style='display:none' src='https://io.narrative.io?noscript=1&id=9'/></noscript>
This is what the nio.js file contains.
! function(t, e, n, r, i) {
"use strict";
var o, a, u = "__nio";
if (!t.nio || 1 !== t.nio.libLoaded) {
var s = function() {
return "//" + r
},
c = function(t) {
var e = typeof t;
return "object" === e && "function" !== e && null !== t
};
o = "undefined" != typeof JSON && null !== JSON && JSON.stringify ? JSON.stringify : function() {
var t = Object.prototype.toString,
e = Array.isArray || function(e) {
return "[object Array]" === t.call(e)
},
n = {
'"': '\\"',
"\\": "\\\\",
"\b": "\\b",
"\f": "\\f",
"\n": "\\n",
"\r": "\\r",
" ": "\\t"
},
r = function(t) {
return n[t] || "\\u" + (t.charCodeAt(0) + 65536).toString(16).substr(1)
},
i = /[\\"\u0000-\u001F\u2028\u2029]/g;
return function o(n) {
if (null == n) return "null";
if ("number" == typeof n) return isFinite(n) ? n.toString() : "null";
if ("boolean" == typeof n) return n.toString();
if ("object" == typeof n) {
if ("function" == typeof n.toJSON) return o(n.toJSON());
if (e(n)) {
for (var a = "[", u = 0; u < n.length; u++) a += (u ? ", " : "") + o(n[u]);
return a + "]"
}
if ("[object Object]" === t.call(n)) {
var s = [];
for (var c in n) n.hasOwnProperty(c) && s.push(o(c) + ": " + o(n[c]));
return "{" + s.join(", ") + "}"
}
}
return '"' + n.toString().replace(i, r) + '"'
}
}();
var f = Object.assign || function(t) {
if (t === i || null === t) throw new TypeError("Cannot convert undefined or null to object");
for (var e = Object(t), n = 1; n < arguments.length; n++) {
var r = arguments[n];
if (r !== i && null !== r)
for (var o in r) r.hasOwnProperty(o) && (e[o] = r[o])
}
return e
},
l = function(t) {
var e, n = [];
for (var r in t) t.hasOwnProperty(r) && (e = c(t[r]) ? o(t[r]) : t[r], n.push(encodeURIComponent(r) + "=" + encodeURIComponent(e)));
return n.join("&")
},
p = "addEventListener" in e,
h = p ? "addEventListener" : "attachEvent",
d = p ? "removeEventListener" : "detachEvent",
m = function(t, e, n) {
e = p ? e : "on" + e;
var r = function(i) {
t[d](e, r, !1), n(i)
};
t[h](e, r, !1)
},
v = {
_isFiring: !1,
numOfRequests: 0,
addQueue: function(t) {
this.queue = this.queue.concat(t)
},
queue: [],
isEmpty: function() {
return 0 === this.queue.length
},
complete: function(t) {
return t || this.queue.shift(), this._isFiring = !1, this._fire()
},
_fire: function() {
if (0 !== this.queue.length) {
var t = this.queue[0],
e = t[0] + "?" + l(t[1]);
return this._isFiring = !0, this.numOfRequests++, e.length > 2048 ? this.fireForm(t[0], t[1]) : this.fireImage(e)
}
},
request: function() {
return this.queue.push(Array.prototype.slice.call(arguments)), this._isFiring ? this._isFiring : this._fire()
},
fireForm: function(t, n) {
var r = this,
i = "nio" + Math.random().toString().replace("0.", ""),
a = e.createElement("form"),
u = e.attachEvent && !e.addEventListener,
s = u ? '<iframe name="' + i + '">' : "iframe",
f = e.createElement(s);
a.method = "post", a.action = t, a.target = i, a.acceptCharset = "utf-8", a.style.display = "none", f.src = "javascript:false", f.id = i, f.name = i, a.appendChild(f), m(f, "load", function() {
var t, i = function(t) {
var e = c(t) ? t.type : null;
return a.parentNode.removeChild(a), r.complete("load" !== e)
};
for (var u in n) n.hasOwnProperty(u) && (t = e.createElement("input"), t.name = u, t.value = c(n[u]) ? o(n[u]) : n[u], a.appendChild(t));
m(f, "load", i), m(f, "error", i), a.submit()
}), e.body.appendChild(a)
},
fireImage: function(t) {
var e = new Image,
n = this,
r = function() {
n.complete()
};
return e.onload = r, e.onerror = r, e.src = t, t
}
},
g = {
companyId: null,
options: {
forceSSL: !1,
forcePost: !1
},
getStandardVars: function() {
return {
companyId: this.companyId,
ret: "img",
ts: (new Date).valueOf()
}
},
errors: [],
error: function(t) {
this.errors.push(t)
},
init: function(t, e) {
this.companyId = t, this.config(e)
},
config: function(t) {
for (var e in t) t.hasOwnProperty(e) && (this.options[e] === i && g.error("Narrative.io: " + e + " is not a valid config option"), this.options[e] = t[e])
},
data: function(t) {
return this.submit(t)
},
submit: function(t) {
var e = s();
e = (this.options.forceSSL ? "https:" : n.protocol) + e;
var r = f({}, this.getStandardVars(), t);
return v.request(e, r)
}
};
t.nio._debug = function() {
return [g, v, a]
}, t.nio.execAction = function(t) {
var e = Array.prototype.slice.call(arguments).slice(1);
switch (t) {
case "init":
return g.init.apply(g, e);
case "data":
return g.data.apply(g, e);
default:
return g.error("Narrative.io: " + t + " is not a valid action")
}
}, t.nio.libLoaded = !0, t.nio.libVersion = "1.0", t.nio.isValid = function() {
return 0 === g.errors.length
};
for (var y = t.nio.queue.slice(), S = 0; S < y.length; S++) t.nio.execAction.apply(t.nio, y[S]);
if (y.length = 0, a = null, t.sessionStorage) {
a = function() {
!v.isEmpty() && c(JSON) && "function" == typeof JSON.parse && t.sessionStorage.setItem(u, o(v.queue))
}, m(t, "beforeunload", a, !1);
var b = t.sessionStorage.getItem(u);
if (null !== b) try {
b = JSON.parse(b), v.addQueue(b)
} catch (O) {
g.error("Narrative.io: " + O.message)
} finally {
t.sessionStorage.removeItem(u)
}
}
setTimeout(function(t, e) {
return function() {
0 === e.numOfRequests && t.execAction("data")
}
}(t.nio, v), 250)
}
}(window, document, location, "io.narrative.io");
I am trying to understand what this script intends to do. Google search did not yield any useful information, and the company hosting the js file does not have much information on it. Hoping to get some javascript expert make sense of this.
This was resolved. The hosting company did some more digging and found out from their development team that this was part of a pilot program to collect some analytics data.

Why doesn't Twitter's follow button widget remember me?

I follow people. I go to check out their sites. Many have a 'follow' button with counter like this one
but if I am I am already following this person the button should be 'grayed' out like this all the time
but once you refresh the page or return at a later time it looks like I am not a follower. Instead, you need to click the 'follow' button on the site, then twitter's dialog box comes up only to tell me that I am already 'following'
and when you mouse over this button it says 'unfollow' in red.
Do does twitter have some sort of Follower.Event.Subscribe function that can recognise people when they are on a site that they 'follow.' If they can recognize follow numbers on a site so why not remember followers?
It come's down Cookies. If the token is not in your browser history how would twitter know that you have clicked it?
What you might find that if you sign into twitter first and then go to the sites and hit refresh it will change to following.
Also if you like me have a tiny Cache for your browser that kills everything on refresh or close then it will definitely not stand a chance at remembering you because your killing the cookie instantly.
UPDATE
It would seem twitter have changed how the use the follow buttons now.
Before if I was logged into twitter and I pressed follow it would just follow them but now I see a gateway popup with a stream etc.
What seems to have happened is Twitter have stopped cookie dropping and opted for a gateway api.
As for the button the key is in the following code:
! function() {
Function && Function.prototype && Function.prototype.bind && (/MSIE [678]/.test(navigator.userAgent) || ! function t(e, n, r) {
function i(s, a) {
if (!n[s]) {
if (!e[s]) {
var u = "function" == typeof require && require;
if (!a && u) return u(s, !0);
if (o) return o(s, !0);
var c = new Error("Cannot find module '" + s + "'");
throw c.code = "MODULE_NOT_FOUND", c
}
var f = n[s] = {
exports: {}
};
e[s][0].call(f.exports, function(t) {
var n = e[s][1][t];
return i(n ? n : t)
}, f, f.exports, t, e, n, r)
}
return n[s].exports
}
for (var o = "function" == typeof require && require, s = 0; s < r.length; s++) i(r[s]);
return i
}({
1: [
function(t, e, n) {
(function() {
"use strict";
function t(t) {
return "function" == typeof t || "object" == typeof t && null !== t
}
function n(t) {
return "function" == typeof t
}
function r(t) {
return "object" == typeof t && null !== t
}
function i() {}
function o() {
return function() {
process.nextTick(c)
}
}
function s() {
var t = 0,
e = new F(c),
n = document.createTextNode("");
return e.observe(n, {
characterData: !0
}),
function() {
n.data = t = ++t % 2
}
}
function a() {
var t = new MessageChannel;
return t.port1.onmessage = c,
function() {
t.port2.postMessage(0)
}
}
function u() {
return function() {
setTimeout(c, 1)
}
}
function c() {
for (var t = 0; U > t; t += 2) {
var e = q[t],
n = q[t + 1];
e(n), q[t] = void 0, q[t + 1] = void 0
}
U = 0
}
function f() {}
function l() {
return new TypeError("You cannot resolve a promise with itself")
}
function d() {
return new TypeError("A promises callback cannot return that same promise.")
}
function h(t) {
try {
return t.then
} catch (e) {
return J.error = e, J
}
}
function p(t, e, n, r) {
try {
t.call(e, n, r)
} catch (i) {
return i
}
}
function m(t, e, n) {
A(function(t) {
var r = !1,
i = p(n, e, function(n) {
r || (r = !0, e !== n ? w(t, n) : _(t, n))
}, function(e) {
r || (r = !0, b(t, e))
}, "Settle: " + (t._label || " unknown promise"));
!r && i && (r = !0, b(t, i))
}, t)
}
function g(t, e) {
e._state === B ? _(t, e._result) : t._state === z ? b(t, e._result) : E(e, void 0, function(e) {
w(t, e)
}, function(e) {
b(t, e)
})
}
function v(t, e) {
if (e.constructor === t.constructor) g(t, e);
else {
var r = h(e);
r === J ? b(t, J.error) : void 0 === r ? _(t, e) : n(r) ? m(t, e, r) : _(t, e)
}
}
function w(e, n) {
e === n ? b(e, l()) : t(n) ? v(e, n) : _(e, n)
}
function y(t) {
t._onerror && t._onerror(t._result), x(t)
}
function _(t, e) {
t._state === H && (t._result = e, t._state = B, 0 === t._subscribers.length || A(x, t))
}
function b(t, e) {
t._state === H && (t._state = z, t._result = e, A(y, t))
}
function E(t, e, n, r) {
var i = t._subscribers,
o = i.length;
t._onerror = null, i[o] = e, i[o + B] = n, i[o + z] = r, 0 === o && t._state && A(x, t)
}
function x(t) {
var e = t._subscribers,
n = t._state;
if (0 !== e.length) {
for (var r, i, o = t._result, s = 0; s < e.length; s += 3) r = e[s], i = e[s + n], r ? O(n, r, i, o) : i(o);
t._subscribers.length = 0
}
}
function T() {
this.error = null
}
function R(t, e) {
try {
return t(e)
} catch (n) {
return W.error = n, W
}
}
function O(t, e, r, i) {
var o, s, a, u, c = n(r);
if (c) {
if (o = R(r, i), o === W ? (u = !0, s = o.error, o = null) : a = !0, e === o) return void b(e, d())
} else o = i, a = !0;
e._state !== H || (c && a ? w(e, o) : u ? b(e, s) : t === B ? _(e, o) : t === z && b(e, o))
}
function N(t, e) {
try {
e(function(e) {
w(t, e)
}, function(e) {
b(t, e)
})
} catch (n) {
b(t, n)
}
}
function C(t, e, n, r) {
this._instanceConstructor = t, this.promise = new t(f, r), this._abortOnReject = n, this._validateInput(e) ? (this._input = e, this.length = e.length, this._remaining = e.length, this._init(), 0 === this.length ? _(this.promise, this._result) : (this.length = this.length || 0, this._enumerate(), 0 === this._remaining && _(this.promise, this._result))) : b(this.promise, this._validationError())
}
function I() {
throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")
}
function P() {
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")
}
function S(t) {
this._id = X++, this._state = void 0, this._result = void 0, this._subscribers = [], f !== t && (n(t) || I(), this instanceof S || P(), N(this, t))
}
var j;
j = Array.isArray ? Array.isArray : function(t) {
return "[object Array]" === Object.prototype.toString.call(t)
};
var L, k = j,
U = (Date.now || function() {
return (new Date).getTime()
}, Object.create || function(t) {
if (arguments.length > 1) throw new Error("Second argument not supported");
if ("object" != typeof t) throw new TypeError("Argument must be an object");
return i.prototype = t, new i
}, 0),
A = function(t, e) {
q[U] = t, q[U + 1] = e, U += 2, 2 === U && L()
},
M = "undefined" != typeof window ? window : {},
F = M.MutationObserver || M.WebKitMutationObserver,
D = "undefined" != typeof Uint8ClampedArray && "undefined" != typeof importScripts && "undefined" != typeof MessageChannel,
q = new Array(1e3);
L = "undefined" != typeof process && "[object process]" === {}.toString.call(process) ? o() : F ? s() : D ? a() : u();
var H = void 0,
B = 1,
z = 2,
J = new T,
W = new T;
C.prototype._validateInput = function(t) {
return k(t)
}, C.prototype._validationError = function() {
return new Error("Array Methods must be provided an Array")
}, C.prototype._init = function() {
this._result = new Array(this.length)
};
var K = C;
C.prototype._enumerate = function() {
for (var t = this.length, e = this.promise, n = this._input, r = 0; e._state === H && t > r; r++) this._eachEntry(n[r], r)
}, C.prototype._eachEntry = function(t, e) {
var n = this._instanceConstructor;
r(t) ? t.constructor === n && t._state !== H ? (t._onerror = null, this._settledAt(t._state, e, t._result)) : this._willSettleAt(n.resolve(t), e) : (this._remaining--, this._result[e] = this._makeResult(B, e, t))
}, C.prototype._settledAt = function(t, e, n) {
var r = this.promise;
r._state === H && (this._remaining--, this._abortOnReject && t === z ? b(r, n) : this._result[e] = this._makeResult(t, e, n)), 0 === this._remaining && _(r, this._result)
}, C.prototype._makeResult = function(t, e, n) {
return n
}, C.prototype._willSettleAt = function(t, e) {
var n = this;
E(t, void 0, function(t) {
n._settledAt(B, e, t)
}, function(t) {
n._settledAt(z, e, t)
})
};
var V = function(t, e) {
return new K(this, t, !0, e).promise
},
$ = function(t, e) {
function n(t) {
w(o, t)
}
function r(t) {
b(o, t)
}
var i = this,
o = new i(f, e);
if (!k(t)) return b(o, new TypeError("You must pass an array to race.")), o;
for (var s = t.length, a = 0; o._state === H && s > a; a++) E(i.resolve(t[a]), void 0, n, r);
return o
},
Y = function(t, e) {
var n = this;
if (t && "object" == typeof t && t.constructor === n) return t;
var r = new n(f, e);
return w(r, t), r
},
G = function(t, e) {
var n = this,
r = new n(f, e);
return b(r, t), r
},
X = 0,
Q = S;
S.all = V, S.race = $, S.resolve = Y, S.reject = G, S.prototype = {
constructor: S,
then: function(t, e) {
var n = this,
r = n._state;
if (r === B && !t || r === z && !e) return this;
var i = new this.constructor(f),
o = n._result;
if (r) {
var s = arguments[r - 1];
A(function() {
O(r, i, s, o)
})
} else E(n, i, t, e);
return i
},
"catch": function(t) {
return this.then(null, t)
}
};
var Z = function() {
var t;
t = "undefined" != typeof global ? global : "undefined" != typeof window && window.document ? window : self;
var e = "Promise" in t && "resolve" in t.Promise && "reject" in t.Promise && "all" in t.Promise && "race" in t.Promise && function() {
var e;
return new t.Promise(function(t) {
e = t
}), n(e)
}();
e || (t.Promise = Q)
},
tt = {
Promise: Q,
polyfill: Z
};
"function" == typeof define && define.amd ? define(function() {
return tt
}) : "undefined" != typeof e && e.exports ? e.exports = tt : "undefined" != typeof this && (this.ES6Promise = tt)
}).call(this)
}, {}
],
2: [
function(t, e, n) {
var r = t(3),
i = t(36);
e.exports = function(t, e, n) {
var o, s, a, u, c = i.aug({}, n);
return arguments.length > 1 && "[object Object]" !== String(e) ? ((null === e || void 0 === e) && (c.expires = -1), "number" == typeof c.expires && (o = c.expires, s = new Date((new Date).getTime() + 60 * o * 1e3), c.expires = s), e = String(e), r.cookie = [encodeURIComponent(t), "=", c.raw ? e : encodeURIComponent(e), c.expires ? "; expires=" + c.expires.toUTCString() : "", c.path ? "; path=" + c.path : "", c.domain ? "; domain=" + c.domain : "", c.secure ? "; secure" : ""].join("")) : (c = e || {}, u = c.raw ? function(t) {
return t
} : decodeURIComponent, (a = new RegExp("(?:^|; )" + encodeURIComponent(t) + "=([^;]*)").exec(r.cookie)) ? u(a[1]) : null)
}
}, {
3: 3,
36: 36
}
],
3: [
function(t, e, n) {
e.exports = document
}, {}
],
4: [
function(t, e, n) {
e.exports = location
}, {}
],
5: [
function(t, e, n) {
e.exports = navigator
}, {}
],
6: [
function(t, e, n) {
e.exports = window
}, {}
],
7: [
function(t, e, n) {
function r(t) {
return a.isType("string", t) ? t.split(".") : a.isType("array", t) ? t : []
}
function i(t, e) {
var n = r(e),
i = n.slice(0, -1);
return i.reduce(function(t, e, n) {
if (t[e] = t[e] || {}, !a.isObject(t[e])) throw new Error(i.slice(0, n + 1).join(".") + " is already defined with a value.");
return t[e]
}, t)
}
function o(t, e) {
e = e || s, e[t] = e[t] || {}, Object.defineProperty(this, "base", {
value: e[t]
}), Object.defineProperty(this, "name", {
value: t
})
}
var s = t(6),
a = t(36);
a.aug(o.prototype, {
get: function(t) {
var e = r(t);
return e.reduce(function(t, e) {
return a.isObject(t) ? t[e] : void 0
}, this.base)
},
set: function(t, e, n) {
var o = r(t),
s = i(this.base, t),
a = o.slice(-1);
return n && a in s ? s[a] : s[a] = e
},
init: function(t, e) {
return this.set(t, e, !0)
},
unset: function(t) {
var e = r(t),
n = this.get(e.slice(0, -1));
n && delete n[e.slice(-1)]
},
aug: function(t) {
var e = this.get(t),
n = a.toRealArray(arguments).slice(1);
if (e = "undefined" != typeof e ? e : {}, n.unshift(e), !n.every(a.isObject)) throw new Error("Cannot augment non-object.");
return this.set(t, a.aug.apply(null, n))
},
call: function(t) {
var e = this.get(t),
n = a.toRealArray(arguments).slice(1);
if (!a.isType("function", e)) throw new Error("Function " + t + "does not exist.");
return e.apply(null, n)
},
fullPath: function(t) {
var e = r(t);
return e.unshift(this.name), e.join(".")
}
}), e.exports = o
}, {
36: 36,
6: 6
}
],
8: [
function(t, e, n) {
function r(t) {
var e, n, r, i = 0;
for (o = {}, t = t || s, e = t.getElementsByTagName("meta"); n = e[i]; i++) /^twitter:/.test(n.name) && (r = n.name.replace(/^twitter:/, ""), o[r] = n.content)
}
function i(t) {
return o[t]
}
var o, s = t(3);
r(), e.exports = {
init: r,
val: i
}
}, {
3: 3
}
],
9: [
function(t, e, n) {
var r = t(7);
e.exports = new r("__twttr")
}, {
7: 7
}
],
10: [
function(t, e, n) {
e.exports = ["hi", "zh-cn", "fr", "zh-tw", "msa", "fil", "fi", "sv", "pl", "ja", "ko", "de", "it", "pt", "es", "ru", "id", "tr", "da", "no", "nl", "hu", "fa", "ar", "ur", "he", "th", "cs", "uk", "vi", "ro", "bn"]
}, {}
],
11: [
function(t, e, n) {
function r(t) {
if (t && /^[\w_]{1,20}$/.test(t)) return t;
throw new Error("Invalid screen name")
}
function i(t, e) {
t.className += " " + e
}
function o(t) {
return t && "false" === t.toLowerCase()
}
function s(t) {
return st.getElementById(t)
}
function a(t) {
return t = t || A.event, t && t.preventDefault ? t.preventDefault() : t.returnValue = !1, t && t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0, !1
}
function u(t) {
var e = R && R.name ? R.name + " (#" + ut + ")" : "#" + ut;
return E ? void(C.title = _("View your profile on Twitter")) : t ? (i(O, "following"), void(C.title = _("You are following %{name} on Twitter", {
name: e
}))) : (O.className = O.className.replace(/ ?following/, ""), void(C.title = _("Fol…
What seem's to be going on here is a handshake with twitters secure server.
So that your information is encrypted.
and all that's happening if the handshake is initiated is that JS is graying out the button.
At no point is this api interacting with the website directly hence why you are not seeing a grayed out button when you are revisiting the site.
It's actually a good think it means that twitter is protecting your privacy as a user.
It also shows that twitter have decided to go down the do not track route for website's so they aren't scoping out a lot of user info.
Sorry about the wait on my answer and the lengthy comment's this must of only happened in recent month's because my last experience with Twitter buttons they had cookie drop's and didnt gateway you like it does now.

Categories

Resources