Apr
06
2008

Cross Site AJAX

Using Script Tag Injection To Achieve The Same End

Sunday, April 6, 2008 - 02:26:43 pm
(Posted Under: Web Development)
Two weeks ago I did a bit of work towards adding Hitter (music that I'm listening to) to my website. Which was always a the end goal when I first wrote Hitter two years ago. Once I put it together, I ended up just leaving it as a stand alone application.

Last month when I first started working on bringing it into my page, my idea was to have it all work through AJAX, which once I build, looked at worked awesome. Aside from having it within my webpage, it was more responsive that looking at Hitter pages directly (because of the amount of information they provide). I was quite happy - until I realized the cross site AJAX problem, once I moved it online. The annoyance being that because of security, browsers don't allow AJAX calls to sites on different domains or subdomains. What a complete pain in the ass!

This is a particular problem since I don't store Hitter on my ISP hosted site. I couldn't (for one, they don't provide mysql), and more to the point, I wouldn't want to. Hence why AJAX was the perfect technology for getting this stuff onto my site, while hosting Hitter on my own server. Perfect, aside from that cross site AJAX caveat! I tried a few things to get around this, without success. I ended up going with iframes, which wasn't that bad, except that the iframes wouldn't resize, and I'd get scrollbars which wasn't particularly nice. But still working.

I brought up the annoyance of the security restrictions at work, and a colleague mentioned script tag injection (thanks Aaron [smile] ). After doing some research today, I came across this article which filled in all the missing parts. Kind of a roundabout way of doing things, but works beautifully!

Hence, now I have my embedded Hitter pages working the way I originally wanted! Sweet.
Now Playing: Tramps & Thieves - The World Is Waiting

Post Comment



All fields are required. Email addresses will not be published, but are required for anti-spam purposas.

Switch Styles

About Style Switching.

!Weblog Index

Mar April 2008 May
SU MO TU WE TH FR SA
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30

Categories

RSS FeedRSS Feed