A long time ago (2003) I created a script that reads js files from the server to the current page just by changing the src of a script element. That progressed to using the DOM, which worked on more browsers. Which progressed to reading js files saved by a Perl script so more dynamic, and then to what I use now, a script that outputs either javascript or HTML depending on how it is requested. Finally I progressed to the page being run by the same method but using a timer to check the the updated time in the database and if the updated time was within 11 seconds the results were pushed to the current page. This now runs my whole site and every site I create including some of the CMS controls that have no database updating ability. Using SSL, which I haven’t been able to justify to outlay yet, would make this possible too although the sites I could offer would of had to be more expensive. I converted my whole site to it some time between April and August 2005 http://web.archive.org/web/20050816112019/http://www.unitingrhythms.co.uk/ (just above Total Hits at the bottom of the page) (From this archived page I guess it was about May) For the UnitingRhythms website I had to go through numerous resellers and in doing so it forced me to learn both asp and php, so it’s written in both.
I’ve been constantly updating both the front-end and back, and have a good permissions sql script which I wrote for PHP/mySQL and asp/access allowing user/group read, user/group write, user/group blocked from reading, user/group blocked from writing. It allows for multiple combinations of each too which is handy. I think this sql may be the most powerful thing I’ve written, taking me a couple of weeks for one line (it does a lot of other things too, all with one query)
I have an asp upload progress bar using ASPupload that’s embedded in the same page. This is from their 3.0 version, which was made to pop up in a small window but using my livescript functions and XMLhttpResponse managed to hack it to work in the current page without the pop up or frames, or the bloated HTML tables with inline css.
The editable area only worked in IE though, and when I upgraded to 9 it stopped working. Before then my only script copied from online was for md5 encryption for asp. A little beyond my league I think. I recently downloaded rangy.js though as the problem I had was with the ranges when selecting content from the editable area. That was difficult to include into my method as well but managed to get that working again within the last couple of weeks. I’m just updating the editable area now (if I could stop procrastinating at sitepoint )
I wrote a small example of the live method here : http://www.sitepoint.com/forums/showthread.php?871350-Live-Server-Side-HTML-JavaScript-Method including other benefits.
But there are more…
It is possible with my method to allow websites running livescript to interact with each other as well. So I could, in my stats page, have a list of links to other livescript websites’ statistic pages and import them to my site to compare server speeds, rather than go to the other site. I don’t need extra scripting on either site either. I have a text file that holds myLiveFriends list of url’s. Rather than change all the links to add ?live=1 the links are checked with this text file first, if the url is in the myLiveFriends list it’s converted to a live link automatically. I use text files as they are faster to read and the data isn’t changed very often. You can see this in action by going to any site, adding /?live=1 to the url and viewing the javascript output. It’s the first bit of javascript executed, and people who do it from an unauthorised site will get an alert.
Also, what I’ve been thinking about lately is shopping carts. As I don’t need cookies to remember data between page changes, and I can import others’ live data to my page, I can add items to a cart from multiple domains.
There are loads of other ideas too, the more I work on it the more I realise what it can do.
If you go to my site, click a few pages and then get the value of page_history from the address bar you’ll see an array. (javascript:alert(page_history)) and page_index holds the current item in the array. This will allow me to create a back button within the page. I could use hashes but I hate sites that do. With this method I can choose what goes in the array, or even let the users choose
Anyway, that’ll do for now, I’ve still got to update the PHP version as a friend requested a site and I want it done by the end of the week as I’m skint!