๐ฒ ZERO CSS and just a single image to build a fully interactive SPA???!!?? ๐ฑ Abusing the internet once more! [Extreme SSR!]
Table of contents
I am back at it again, abusing the internet and this one should really blow you away.
This time I really do think I have outdone myself.
I present to you:
A 3 page SPA with an interactive poll and a contact form, with no CSS and one DOM element - just a single image! (go on, inspect the page!)
I call it "Extreme Server Side Rendering (SSR)" ๐คฃ
PLEASE NOTE: - if using a mobile you cannot use the contact form, I couldn't find a way of opening the keyboard without an <input>
I am afraid! Try it on PC instead!
FINAL THING: Due to the round-trip time to the server the page feels "laggy", if you are on a 3G connection it might be unusable so wait until you are on a better connection before trying it!
> > > > Try the single image SPA here! (best viewed on PC) < < < <
What can I do in the SPA?
There are some fun bits for you to try:
It kind of works with a keyboard
Well, you can Tab to elements to highlight them. You can even activate them with "Enter".
Just don't expect a smooth experience (and I have only tested it in Chrome so it may not work in other browsers!)
The home page is responsive
Yup, if you try it on your mobile the home page actually has two different versions, a mobile one and a desktop one.
On mobile you can even open and close the menu!
I sadly didn't have time to make the other two pages responsive (this silly project took ages already!).
The poll actually works!
Cast your vote on the SPA as to what you think of my silly experiments!
The current results are as follows:
This has to be the stupidest thing I have ever seen - I love it! 63%
Quite silly, being rick rolled by ASCII text was sillier though! 21%
This is silly? I thought this was what server side rendering was! 15%
The contact form "works"
It is one of if not the worst experiences you will ever have on the web, but it works!
In fact you can see the messages people have posted via the SPA in the final section!
What is actually going on here?
Oh loads!
Essentially every interaction with the page is being tracked with JavaScript and cookies.
I am then sending that to a script on my server that renders an image based on mouse position, current focused item, keys pressed and more. I then send the constructed image back so you can view it!
Needless to say I now have a much greater appreciation for browser developers as there are so many little things that I just take for granted!
To give you an idea of how difficult this is, from the X and Y coordinates of the mouse I calculate if an item is hovered. To do that I need the X, Y, width and Height of each item on the page. I also need to know what state to turn that button to.
Now if you click, I have to check if the click is within the bounds of a button and what action should be performed!
Multiply that by 3 pages worth of buttons and inputs and a few other features and there is an awful lot I had to plumb together!
Final words before the comments
As with all of my silly experiments, there is no real point to this, just a bit of fun for you on a Friday!
Have a fantastic weekend!
User comments submitted via the contact page (may be disabled if people cannot behave ๐)
Here are a few comments that people have added via the single image SPA!
Heads up: this doesn't work on Hashnode yet, you will have to head over to dev.to/inhuofficial
InHuOfficial - 17:11 21/05/2021 I look forward to seeing the messages you all post! Don't forget that you have to wait one minute before refreshing this page to see your comment!
asdfsadf - 17:40 21/05/2021 asdfasdfasdfasdfsaf
testt - 17:41 21/05/2021 est
55 - 18:30 21/05/2021 55
dakujem - 18:38 21/05/2021 serus
gghh - 19:08 21/05/2021
yyyyyyyy - 19:37 21/05/2021 yyyyyyyy
this is a test - 20:19 21/05/2021 wow wtf
gwdsdg - 20:25 21/05/2021 gggewgg sd mdgkgj sdkjgsodj g12 jr128 jdg sdg sdg jo sdjgojidsgdsg sodj g
gwdsdg - 20:25 21/05/2021 gggewgg sd mdgkgj sdkjgsodj g12 jr128 jdg sdg sdg jo sdjgojidsgdsg sodj g
sdg - 20:25 21/05/2021 dsgsdgsdgdgsdg
fhfjfjgjj - 21:28 21/05/2021 fgjfgjfgjfgjgj
DEVusedToBeGoodNowItSucks - 21:45 21/05/2021 This sucks What a waste of time DEV to has gone to shit in the last year
hi there - 22:46 21/05/2021 this is some text
fds - 00:56 22/05/2021 sdfhg dgdrfg dfg
Losh531 - 03:23 22/05/2021 um hello
hehe - 03:25 22/05/2021 g
kkklmmm - 04:07 22/05/2021 nnnnnn
F5 - 09:55 22/05/2021 lol this is wired as fukc but idea is fkced as well its not even fast s and no accesabiltity
Arkentias - 14:47 22/05/2021 Good job !
bingus - 16:43 22/05/2021 haha yes
dqsqsqds - 17:05 22/05/2021 qsd
dillir07 - 17:25 22/05/2021 Wow!!!
JulCzar - 18:35 22/05/2021 let tringSomthingNew eq true semicolumn while (tryingSomthingNew) learn() semicolumn
JulCzar - 18:35 22/05/2021 let tringSomthingNew eq true semicolumn while (tryingSomthingNew) learn() semicolumn
Nicolas - 21:22 22/05/2021 Test
3321321321 - 06:54 23/05/2021 321321321321321
xczxcxcvxvxvxvxcv - 07:34 23/05/2021 xcvxcvxcvxcvxcv
bcrypt - 01:51 24/05/2021 This is a work of art
** - 04:09 24/05/2021 s
test - 10:51 24/05/2021 lolw
ffghfghfghfg - 11:13 24/05/2021 hfgh
gggggggggggggggggg - 11:48 24/05/2021 gggggggggggggggggggggggg
daadadad - 13:59 25/05/2021 asdasdasdasdasd
# Foobar - 14:38 25/05/2021 This is pretty nifty I know it says letters numbers and spacesbut what about emojis although I guess those wont work if you cant use a keyboard here
jumanji - 18:32 25/05/2021 Boop Bap!
sidchaudhary04 - 21:04 25/05/2021 Hi This is witchcraft wow
sidchaudhary04 - 21:04 25/05/2021 Hi This is witchcraft wow
sidchaudhary04 - 21:04 25/05/2021 Hi This is witchcraft wow
crycx - 07:24 26/05/2021 Love it!
piyush - 17:03 26/05/2021 Hello World
piyush - 17:03 26/05/2021 Hello World
** - 08:09 27/05/2021 hfhfghgf
** - 15:46 27/05/2021
** - 16:31 27/05/2021 This works maybe
test one two three - 01:28 28/05/2021 i like chicken i like liver meow mix meow mix plz deliver
sdsdsdd232322 - 13:53 28/05/2021 ddddddd
collegewap - 15:15 28/05/2021 Hello
pelayo - 20:20 01/06/2021 That was awesome
fsdkfdskjfksdjfaksda - 10:28 11/06/2021
burger and fries!!!! - 19:23 17/09/2021 trololololo hehheheheHOhohoho i am the silly man!!!!
For the Algo!
If you enjoyed this article, give it a โค๐ฆ and don't forget:
Leave a comment for the algorithm! (even if it is just to say how silly I am ๐!)