Skip to content
Advertisement

Open link in new window or focus to it if already open

I have a link which should open in a new tab, but if the tab is already open, just switch to it. I’ve tried with javascript, wnd = window.open() and than wnd.focus(), that works in Chrome 19, but not in FF 13 or IE 9. Here’s the code I’ve written : Any idea how can I open or switch to

Sorting in Javascript with special characters

I have an array with the following values and i want to sort it in javascript in the following way in to three parts. word starting from special character word starting from digit word starting from alphabets. So this should be the sequence of the sorted array. EDIT: Here’s a function that I’ve been experimenting with: Answer To be honest,

Determine if Lat/Lng in Bounds

I’m interested in determining if a lat/lng location is within the bounds and looking for recommendations on a algorithm. (javascript or php) Here is what I have so far: will this work? thanks Answer The simple comparison in your post will work for coordinates in the US. However, if you want a solution that’s safe for checking across the International

How to add/subtract dates with JavaScript?

I want to let users easily add and subtract dates using JavaScript in order to browse their entries by date. The dates are in the format: “mm/dd/yyyy”. I want them to be able to click a “Next” button, and if the date is: ” 06/01/2012″ then on clicking next, it should become: “06/02/2012”. If they click the ‘prev’ button then

Why does my http://localhost CORS origin not work?

I am stuck with this CORS problem, even though I set the server (nginx/node.js) with the appropriate headers. I can see in Chrome Network pane -> Response Headers: which should do the trick. Here’s the code that I now use to test: I get XMLHttpRequest cannot load http://stackoverflow.com/. Origin http://localhost is not allowed by Access-Control-Allow-Origin. I suspect it’s a problem

Advertisement