I’m working on a project which includes seasonal content, and we’re thinking of determining the user’s location to work out what season it is for them. The obvious way of doing this is to Geo-locate their IP, then grab the latitude. > 0 is Northern hemisphere, and < 0 is Southern. I’m happy to go that way – though it
Tag: http
URL Encode a string in jQuery for an AJAX request
I’m implementing Google’s Instant Search in my application. I’d like to fire off HTTP requests as the user types in the text input. The only problem I’m having is that when the user gets to a space in between first and last names, the space is not encoded as a +, thus breaking the search. How can I either replace
Detect when a user leaves a website
I am trying to create my own website access library (for fun) like Google Analytics where I can detect when a user accesses my website, what pages they view etc. Is there a way to determine when the user leaves a page &/or leaves the website for good? I have successfully coded (in python) the detecting when the user 1st
How to spoof site referrer?
I have 2 pages : 1.php and 2.php When the user arrives on 2.php, i want to show on 2.php that the user is arriving from google.com and NOT from 1.php I tried spoofing the header of 2.php using when i do a javascript document.write(document.referrer); it shows me 1.php Any help is appreciated. Answer The http referrer is a request
Checking if a URL is broken in Javascript
This question has been posted on Stack before, but none so specific as to what I’m trying to understand. The simplest way to check if a URL is corrrect to send a http Head request. But how do you use that to specify the URL ? I found this in a previous post : But it doesn’t seem to run
Lightweight web browser for testing
I have e very specific test setup in mind. I would like to start a web-browser that understands Javascript and can use HTTP proxy, point it to a URL (ideally by specifying it in the command line along with the proxy config), wait for the page to load while listening (in the proxy) requests are generated as web-page is rendered
When serving JavaScript files, is it better to use the application/javascript or application/x-javascript
The whole question fits in the title. And to add some context: I’m not asking what is the best according to what the specs are saying, but rather what works the best given the mix of browsers deployed nowadays. Some data points: Google uses text/javascript for the JS used on their home page. Google uses text/javascript on Google Docs. Google
caching JavaScript files
Which is the best method to make the browser use cached versions of js files (from the serverside)? Answer Have a look at Yahoo! tips: https://developer.yahoo.com/performance/rules.html#expires. There are also tips by Google: https://developers.google.com/speed/docs/insights/LeverageBrowserCaching