S
S
Sirion2013-07-11 17:40:02
Google
Sirion, 2013-07-11 17:40:02

two-faced google

Good day, dear Khabrovites.

In the process of writing a userscript that adds a couple of goodies to the google.ru search page, I discovered a strange (and very unpleasant) thing. It turns out that the page that I see from my work computer and the page that I go to at home are two big differences. For example, a search form at work has id="tsf" and at home it has id="gbqf". Moreover, the difference is not only at the level of IDs - the DOM structure is also different.

In this regard, I have a question: why is this happening and how many more options for this page can be seen from different places? You understand that writing a userscript for a page with a variable structure is not the most pleasant experience.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stepan, 2013-07-11
@Sirion

It all depends on the browser. For some, the form does not have an id at all (for example, ipad).
The same for all is form action="/search" and input name=q.
In my opinion, this is quite enough for any user script.

Of course, in both cases, the input I need comes first.

But this is not entirely true. On the same iPad, the first input is not the same as the others that I looked at. I don't think this should be taken into account.

I
ivnik, 2013-07-11
@ivnik

I have id="gbqfq".
What's stopping you from looking for "input" with type="text"?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question