jQuery check if Cookie exists, if not create it

I think the bulletproof way is: if (typeof $.cookie(‘token’) === ‘undefined’){ //no cookie } else { //have cookie } Checking the type of a null, empty or undefined var always returns ‘undefined’ Edit: You can get there even easier: if (!!$.cookie(‘token’)) { // have cookie } else { // no cookie } !! will turn … Read more

What is the most reliable way to hide / spoof the referrer in JavaScript?

I have found a solution which works in Chrome and Firefox. I’ve implemented the code in a Userscript, Don’t track me Google. Demo (tested in Firefox 9 and Chrome 17): http://jsfiddle.net/RxHw5/ Referrer hiding for Webkit (Chrome, ..) and Firefox 37+ (33+*) Webkit-based browsers (such as Chrome, Safari) support <a rel=”noreferrer”>spec. Referrer hiding can fully be … Read more

Getting the IP address of server in ASP.NET?

This should work: //this gets the ip address of the server pc public string GetIPAddress() { IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName()); // `Dns.Resolve()` method is deprecated. IPAddress ipAddress = ipHostInfo.AddressList[0]; return ipAddress.ToString(); } http://wec-library.blogspot.com/2008/03/gets-ip-address-of-server-pc-using-c.html OR //while this gets the ip address of the visitor making the call HttpContext.Current.Request.UserHostAddress; http://www.geekpedia.com/KB32_How-do-I-get-the-visitors-IP-address.html

Can I get the referrer?

You can pass this value along: document.referrer. That expression would need to be evaluated on website 2, not on website 3. So: // website2.html <img src=”https://stackoverflow.com/questions/6856697/website3.com/pxl.gif” id=”pxl” /> <script> document.getElementById(‘pxl’).src += ‘?ref=” + encodeURIComponent(document.referrer); </script> The request to website3 will then include the referrer.

Get referrer after installing app from Android Market

I would try to help who, like me, fails to make install_referrer work and who don’t find ANY useful information about these features. Notes: The intent com.android.vending.INSTALL_REFERRER will be caught during the install process, not when the application starts for the first time. The referrer …extras.getString(“referrer”).. is fixed but the contents can be any string … Read more