|
XMLPitStop: Interacting with the matrix
Taking a Byte out of XML
Interacting with the matrix.
By Mikael Bergkvist
Dec 8, 2004
I dont know if you've noticed, but the web isn't as
safe as it used to be. Ordinary images pose a danger and various experts are
recommending people to turn off javascripting. So, what if they actually did
turn off javascripting?
The user-experience would be severely damaged for one.
No vendor would ever make such a damaging decision, but people have a will of
their own (damn, there goes my plans for world domination) and if scared
enough, they could choose to do this. Then a lot of interactivity would
transfer to java or flash, but my IE6 reacts to both after each security
upgrade. I keep turning it off, but it keeps coming back, and it's getting to
be quite annyoing. It's reminding me of that "assistant" that kept popping up
in Word a few years back, which made me download a freeware that allowed me to
shoot it down with a shotgun. (It was hilarious and very liberating) The again,
there are other browsers.. ;-)
I imagine that some of the interactivity will
eventually transfer to the server, where it won't really matter if the user has
javascripting turned off or not, but then other problems arise. Keeping track
of what the user has done, or where, is more difficult serverside. You end up
with a lot of if/else, and an awful lot of embedded html depending on the
responses. You got to hand it to plain old dhtml - using the DOM to find an
element and directly manipulate it for immidiate feedback, making it ideal for
interfaces.So why not migrate dhtml, or that particular quality,
to the server? Yeah, well, how? Simply merge asp 3.0 and xml into a new format,
which has a boring productname attached to it (miopages) and there you have it.
Load the asp 3.0, as xml, and then manipulate elements for immidate feedback,
by ID, NAME, or place in the DOM-tree.
<html>
<serverscript allow="newfun">
function newfun(str, arg){
getElementByID(arg).text=str;
}
</serverscript>
<a exec="newfun('Hello world','a')">Call function</a>
<br/>
<p id="a">Output goes here</p>
</html>
After the link was clicked, we get this sent to the browser.
<html>
<a href="adress.asp?newfun('Hello world','a')">Call function</a>
<br/>
<p id="a">Hello world</p>
</html>
Miopages accepts querystrings only as function calls. Functions takes arguments and live or die by
them, so it's harder to manipulate in a hostile manner. If a function "dies", it get's thown and the page
reloads. The function must also be permitted, so in this example, the server will only accept newfun() and the arguments
has to be plain text. Everything else "dies".
So, we have recreated the immidate feedback that is typical for dhtml, and we used xml to do it.
The DOM remains in memory as a thread allthrough the session, and therefor you can run several apps simultainously, along
with other visitors doing the same thing. We added a really long list of features to this thing, but those are outside the subject for this column, so we are skipping
those here. The point is that XML has in it's very conception the possible solution for some of the problems that might occur in an immidiate
future, and that it allows developers to continue to use their current dhtml-skills to handle the situation. The big drawback is, of course, the reloadings of the page - but hey, nothing is perfect.
If it was, the web would be a much safer place. And I would be dating twins.
Signing off:
Mikael Bergkvist
Naltabyte
You can find a lot of more or less advanced examples
at out site (plug, plug) here:
http://www.naltabyte.se , under "miopages".
(We do use javascripts, off and on, but that's because
we are lazy, and because it's kinda fun too.)
|