edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] DOMContentLoaded
@ 2018-03-13  7:48 Karl Dahlke
  2018-03-14  2:21 ` Kevin Carhart
  0 siblings, 1 reply; 2+ messages in thread
From: Karl Dahlke @ 2018-03-13  7:48 UTC (permalink / raw)
  To: Edbrowse-dev

[-- Attachment #1: Type: text/plain, Size: 2597 bytes --]

tsp asked a relatively innocent question, which led to an interesting result.

	Why can't we get to   http://www.royalroadl.com

It gives http error 503, temporarily out of service. That makes you think their server is down, so you walk away and try later. But you always get this misleading error, always.

The page has some skeleton html and a couple dozen lines of javascript.
The skeleton is a form that says they are checking our browser,
and could I wait a few seconds.
I waited, plenty long enough, and then pushed submit, and got the same page with the same 503 error and the same form back again.
Time to read through the somewhat cryptic javascript.
The function basically attaches another function to document under the event DOMContentLoaded, and that's it.
It never dispatches that event, which means we're suppose to, and we don't.
I read about DOMContentLoaded on the internet.
Is it suppose to come before or after onload? Not clear.
Is it suppose to run like a function, as we do with onload, or through the dispatchEvent system? Not clear.
I did it the easiest way possible, called document.onDOMContentLoaded() at the end of runOnload() in html.c.

And what would this function do if it were run?
It does all sorts of weird computations in javascript, and updates a hidden input field with the answer, then it submits the form.
When I submitted the form manually it didn't cut any ice, because js had not put the correct answer in the hidden field.
I had to run js, and update the field, and submit the form.
This went to another page on the website wich verified the answer.
Apparently it was correct, because http 302 redirected me back to the home page, yes, the very same home page,
and this time it let me in.  Code 200.
How did the home page know I had passed the test?
I didn't see any cookies fly by.
Did it record my IP address as ok?
That's rather crude; a thousand computers on an intranet can be behind one ip address as the gateway.
I don't know how it works on the server side, which frustrates me a little.
I do know that one line of code made the difference between being locked out and getting in. (Latest push).

1. Whoever said more and more sites will need js just to browse, was correct.

2. Whoever said events were critical to the success of edbrowse and javascript, was correct.

This is going to be a js intensive website, almost as bad as nasa.
I got you in, but not clear how many functions will work inside.
I'm sure we'll discover more things that we are missing, or not implementing correctly.

Karl Dahlke

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Edbrowse-dev] DOMContentLoaded
  2018-03-13  7:48 [Edbrowse-dev] DOMContentLoaded Karl Dahlke
@ 2018-03-14  2:21 ` Kevin Carhart
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Carhart @ 2018-03-14  2:21 UTC (permalink / raw)
  To: Edbrowse-dev

> I read about DOMContentLoaded on the internet.

It's good that we're encountering this.  You definitely find it a lot in 
various pages' JS files.  The fact that it would fire once suggests to me 
that it is part of the set that runs like a function.  I had what I 
thought was a possible "aha" type of observation about the two event 
systems during the previous thread about events. But then I was wrong 
about "on" so I don't know if I'm on to something or not here, BUT: I 
think the ones that are handcrafted functions tend to be the ones that run 
a small number of times and you know in advance what they are.  The ones 
that might be doled out dynamically and have new, made-up names that don't 
hew to a metaphor the way click does, are not going to be the ones that 
run like a function, because you don't know at compile time what they are. 
Based on this breakdown, DOMContentLoaded is probably "on the order of," 
same kind of animal as, onclick and onload.  Older, more established, a 
hardcoded name, a fixed job that it does related to DOM.  That's my 
educated guess.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-14  2:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13  7:48 [Edbrowse-dev] DOMContentLoaded Karl Dahlke
2018-03-14  2:21 ` Kevin Carhart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).