With regard to the origin of gander in the sense of "take a long look at," it's interesting to compare the definitions of gonder in Thomas Darlington, Folk-Speech of South Cheshire (1887) with the corresponding definitions in Robert Holland, A Glossary of Words Used in the County of Cheshire (1886)—just one year earlier.
From Darlington, Folk-Speech (1887):
Gonder, v.n. To stretch the neck like a gander, to stand at gaze. "What a't gonderin' theer fur?" ... (2) to ramble, walk heedlessly. "Wheer't tha gonderin' off to?"
From Holland, Glossary (1886):
GONDER, v. (1) to ramble in conversation, to become childish. W. CHES. (2) to go heedlessly. MID-CHES. "Wheer art gonderin to?"
So while Darlington and Holland agree as to the sense "walk or go heedlessly," they have quite different alternative meanings for the verb gonder.
Roger Wilbraham, An Attempt at a Glossary of Some Words Used in Cheshire, second edition (1826), published 60 years earlier, doesn't include an entry for gonder (or gander) at all, although it does have one for gander-month:
GANDER-MONTH, s. the month in which a man's wife is confined in lying in.
Egerton Leigh, A Glossary of Words Used in the Dialect of Cheshire (1877) essentially repeats Wilbraham's wording for gander-month and adds two entries for gonder:
GONDER, s.—A gooseberry. L.
GONDER s.—A gander. Also, a fool, "What a gonder thee art, Raphe!" L.
—but no verb forms of gonder.
Meanwhile, Georgina Jackson, Shropshire Word-book (1879) has this meaning of gonder as a verb:
GONDER (2) v. n. to mope about.—PULVERBATCH [near Shrewsbury] 'That fellow's good fur nuthin' but gonder about like a kimet ship ["dizzy sheep"].'
Also of interest is a discussion by "W. J. C." in [Manchester] City News Notes and Queries (March 5, 1881) of the meaning of gondering in South Cheshire and of differences between that district of Cheshire and the district north of it:
I fear MID-CHESHIRE [a correspondent to the newspaper] did not read my communication of the 12th with care, or he would have noticed that I stated distinctly the particular district in which the words I gave are used. I must therefore beg to state again that South Cheshire is the district to which I referred, and he writes from Mid-Cheshire. Now it is well known that dialect words are used in one part of a county that are never heard in another part. ... "Gondering," to wander heedlessly, is used with the same meaning in South Cheshire [as in Mid-Cheshire]; and "gonder," a noun, is applied to person, and signifies one who does not mind where he is going.
Thus, seven years before Darlington finds gonder being used in South Cheshire to mean "stretch the neck like a gander" and "stand at gaze," W. J. C. of South Cheshire, in discussing gondering, indicates no awareness of that usage.
But lest it appear that South Cheshire's gondering is a dead end on the road to "take a gander," Joseph Wright, The English Dialect Dictionary (1900) cites the Darlington definition as part of a longer subdefinition of gander:
7. To stretch the neck like a gander, to stand gazing, look foolish ; to use conceited airs and gestures.
Wright also cites a much earlier instance of a similar usage of the word, albeit one involving a different variant spelling: gaindering. The citation is to James Hogg, The Three Perils of Man (1822), a novel set on the Scottish/English border, which includes this dialogue:
"Poor tafferel ruined tawpies! What are ye gaun gaindering about that gate for, as ye didna ken whilk end o' ye were uppermost?"
"That's easily kend father. What has come ower ye? Hae ye seen a warlock that ye are gaping and glowring at sic a dismal rate?"
In this scene, a farmer has spotted a band of border rovers descending on his farmhouse, and he has rushed back to the house, where his daughters, surprised at his unexplained franticness, are not wandering about aimlessly but staring out the door.
The complication here is pointed out by John Jamieson, Supplement to the Etymological Dictionary of the Scottish Language, volume 1 (1825):
To GAINDER, (g hard), v. n. To look foolish, Ettr. For. [Hogg quotation omitted] Supposed to signify, to look like a gander. But it is perhaps originally the same with GAINTER, q. v.
To GAINTER, v. n. To use conceited airs and gestures ; Gainterin', having the appearance of assuming conceited airs; Upp. Clydes.
Still, from the context of the Hogg quotation, it's fairly clear that the farmer's daughters have not gone to the gate conceitedly, but out of curiosity and alarm—and possibly with their necks craned. If so, the origin of gander in the sense of "stretching one's neck like a goose in order to stare at something" may be traced (as gainder) to 1822—sixty-five years before the South Cheshire origin (as gonder) cited by the Online Etymology Dictionary—unless (as is possible) Hogg's farmer meant gaindering in the sense of "wandering foolishly," a sense of the verb gander that the Online Etymology Dictionary dates to the 1680s. Wright, at any rate, doesn't attribute the "wandering foolishly" sense to gaindering in Hogg's dialogue.