jshawl / jshawl/future

Search query is saved as undefined if user searches from google.com

Open
#1 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

In app.js:

var query = window.location.search.substr(1).split("&")
var params = {}
query.forEach(function(q){
  var qs = q.split("=")
  params[qs[0]] = qs[1]
})

If the google search originates from the chrome search bar then:
windows.location="https://www.google.com/search?q=example+search&oq=example+search&aqs=chrome..69i57j69i60l4j69i61.2358j0j1&sourceid=chrome&ie=UTF-8" and //params.q => "example+search"
However if you search from the google homepage (www.google.com) you get the following:
windows.location="https://www.google.com/?gfe_rd=cr&ei=vAiIV9GnBKSA8QfI_afwAw&gws_rd=ssl#q=example+search" and //params.q => undefined so in that case the search query is not saved correctly; it is saved as undefined in the database.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in app.js at the query-string parsing shown in the issue and reproduce both Google URL forms. Verify that the search query is captured for the homepage URL as well as the search-bar URL, then confirm the saved value is no longer undefined.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.