Cross domain requests (also known as Cross Origin Resource Sharing) can be made using JavaScript without trickery, as far as I can tell, in Firefox 3.5, Safari, Google Chrome and Internet Explorer 8. This is done with all browsers except IE8 using a standard XMLHttpRequestobject. The only thing required to notify the browser that JavaScript is allowed to make this request is for the server to send a Access-Control-Allow-Origin response header. Internet Explorer 8 uses an object called XDomainRequest and requires the same HTTP header. If the value of the header is * then requests are allowed from all domains. You can be more restrictive if required.
(More …)
Latest Updates: JavaScript RSS
-
Making cross domain JavaScript requests using XMLHttpRequest or XDomainRequest
Phil Leggetter
-
How does Google Real-Time Search work?
Phil Leggetter
On or around the 12th of December 2009 Google released a feature they are calling “real-time search”.
Our real-time search enables you to discover breaking news the moment it’s happening, even if it’s not the popular news of the day, and even if you didn’t know about it beforehand.
Although I’d still argue that we’re not seeing the real-time web with this solution I thought I’d go in to a bit of detail about how Google are achieving this HTTP polling solution.
Summary
- Google are consuming and indexing real-time data from multiple social networks
- It’s not real-time HTTP PUSH yet, it’s HTTP PULL using a polling interval
- The polling interval seems to vary but this needs to be confirmed.
- The polling result returns an encoded JSON response containing the next request to be made and the HTML of any new results. These results are injected into the “Latest results” section of the page
- The HTML returned is quite verbose and could be refined
- 87% from a sample of 30 polled requests returned no new results meaning the request was a waste of resources
-
Which Rich Internet Application Technology will dominate?
Phil Leggetter
I’ve been a member of the RIA Developers Group on LinkedIn for a short while now and the other day Patrick Bay posted a link to an interesting article on Computer Weekly about the prominence of RIAs. A few comments were posted and then Patrick questioned which RIAs would “bubble to the top”.
I think the UI revolution’s already here; now we see which ones bubble to the top!
This got me thinking about the criteria that may determine which RIA technology would be most successful.
I think there are a number of things that will determine which one will ultimately win, or at least become the dominant choice. At the moment I can think of three categories; Technology buy-in, Development environment and Data access capabilities and choice.
(More …) -
Drag Drop bug in JQuery UI 1.5.3
Phil Leggetter
JQuery UI Update – 31/01/2009 @ 17:15
Richard Worth just got in touch with me via twitter to let me know that JQuery UI 1.5.3 is only compatible with JQuery 1.2.6.
The bug is not in jQuery UI 1.5.3, but just that 1.5.3 is only compatible with 1.2.6. Only 1.6rc5+ is compatible with jQuery 1.3
Therefore to use JQuery with JQuery UI from the Google Ajax Libraries hosted service you need to do one of the following:
Script includes
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"> </script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.jss"> </script>Google Library loading
google.load("jquery", "1.2.6"); google.load("jqueryui", "1.5.3");—
JQuery seems to be the most active of the JavaScript libraries at the moment so I decided to use it for a little project. I’ve also decided to use the Google AJAX Libraries APIs hosted service to serve up the JavaScript files. At present Google is hosting JQuery UI version 1.5.3. After a bit of investigation I’ve determined that there is a bug in the Drag and Drop functionality in this version. It would appear that the “drop” function is not fired when you try to drop a draggable element on a droppable zone. I verified this by changing the JQuery UI version to the 1.6 RC that the JQuery UI droppable demo is using at the moment. When I did this the drag and drop functionality worked as expected.

This may be a know issue but I thought a small post on the matter might save other people a bit of time. I did have a look at raising a bug but there appears to be a bug in the bug tracking system.
-
Phil Leggetter
Mapping APIs have been around for ages now and all the big guns (Google, Yahoo, Microsoft) have thrown their hat into the ring. You can even get a Google maps plugin for wordpress plugin to allow you to easily put a map in your blog.
There’s even an API that allows you to switch between using all three – but it doesn’t look like it’s been updated in quite a while.
All these examples exploded onto the scene but haven’t really made any major advances, that my naked eye can see, for quite a while. Why is this? Is it that they are as good as they can possibly get? Or is development stagnant for another reason? Maybe it’s lack of data! Whilst people are forever creating mashups of this on top of that with a little bit of the other thrown in the unfortunate thing for me is that there hasn’t really been anything that has blown my mind since the very early days of DHTML maps. Somebody please prove me wrong!
Maybe it’s time for the OS to start setting the data free so that people can actually benefit from the high quality data without paying through the nose – then maybe we’ll see some great UK mashups.
-
A Career Using JavaScript
Phil Leggetter
Since most of the hits to my site will probably be following a search for either “Leggetter” or “JavaScript” I thought that I had best post something about the latter of these topics.
My knowledge of JavaScript has been gained by working for companies that have used Web Technologies in their products. My first job was in London back in 2001 and at this time I would guess that JavaScript would not have been classed as a mainstream programming language. I guess that many would still not think of it as mainstream but it certainly has become more prominent with the use of AJAX. Its common uses back in 2001 would have been to create rollover effects or dynamically write page content on the client-side using
document.write. However, the company that I worked for used it as a main language to develop a product to deliver real-time financial data in a browser to the PC desktop. So, over my two years at this company my knowledge of this language grew considerably.As well as using JavaScript to develop my employers products I used it in developing my own small web applications, web sites and small to medium bits of functionality for friends sites or web applications. I also used to contribute to “comp.lang.javascript” and a few forums but as the popularity of the language increased as did the number of people who wanted to ask and solve JavaScript questions. Also, as the number of JavaScript users increased the number of simply solved questions were asked. It became a challange in itself to find that challanging DHTML/JavaScript question. With the JavaScript community getting so crowded I decided to leave the newsgroups and forums to those with a bit more spare time.
Even though I had decided to leave the forums alone it did not mean that I left JavaScriptalone. Indeed I made a move north to Scotland to work for a small company that used JavaScript and DHTML to deliver simulations of a variety of real life applications. These simulation ran purely in a browser and used a very clever combination of JavaScript, HTML, DTHML and Java to deliver high quality simulation products to large financial service companies. Whilst at this company my knowledge of cross-browser compatibility issues increased considerably.
Two years on I made the decision to make a move to a company that did not use JavaScript as its primary development language. At the very same time as I had made my decision to move on the idea of AJAX came about and JavaScript took another leap in popularity. Whether or not its popularity will mean that my current company come up with more ideas on how to use JavaScript in the same guise as Google Maps is yet to be seen.
So, what is the point in this post? Well, I suppose it has turned into a mini career biography and also has proven that a career in Software Engineering can be acheived using JavaScript as a primary language – although it has to be said that I was quite lucky that my first two companies were so specialised in its use. I guess the point is also to highlight that I’m very experienced in the use of this language so if anybody has any questions about a piece of JavaScript code, a “How To” question or a piece of contract work that they need an experienced JavaScript/DHTML developer to take on they should get in touch with me.
A final note that I would like to make is that during my career I have gained experience in a variety of other languages as well as general software engineering skills. The languages that I now consider myself very capable of using are:
- JavaScript
- DHTML
- SQL
- C#
- Java
- PHP
- VBScript












