Showing posts from May, 2019

making a chatbox with localStorage Javascript

So I got so excited to make this all work on my website, that I deleted my old repo I was using last weekend (on which I did all the JavaScript work) and downloaded my latest website version.....

I will make another post to explain all this in a much simpler way,  but I just want to make sure the code is out there on the interwebs so I don't loose 10 hours of work again. 

The biggest problem I was having, was not understanding that I couldn't properly save an array to localStorage.  I fiddled with JSON a ton today, but I couldn't get it to work.  I also knew I did not use it the last time to make my chatbox work, so the answer was somewhere else, and much simpler.

simple answer:

I was trying to split up this giant string, get it into arrays, get it into separate localStorage items... When all along I just needed to add "<br>" and change the innerHTML to my giant string I kept adding to in my localStorage.

My chatbot Whispering Wall, in d…

javascript: first steps of chatbox

Keeping with tradition of these javascript experiments, this is set up just like all the others:   My html, and js file are in my desktop folder, and I double click my html file to see it run in the default browser. 

I want to make my whispering wall's text display in a chatbox, so the user can see what they typed, and prior conversations.
As of now, the whispering wall will take input, process it through the NLTK and python code, and return a response to screen.
But none of the input is kept (or previous Wiwa responses) once the html is refreshed with the retrieved response from my scripts.

So the first thing to do is see how to create this scrolling text box.
This post only covers the experiment of creating/exploring how to display a chatbox.
( I am hoping to create the second part to this experiment today which will cover placing a script line from a file, into the chat box.)

Just a few items I had to look up for the HTML javascript code:
"clearing input field":  htt…