Difference between #k= and ?k= in the url
-
11-10-2020 - |
Domanda
We have a custom JavaScript input box that passing the search term to the search result in a public SharePoint site.
When a user log in to the site and search for stuff, everything works great. However, when an anonymous visitor try to search for something without log in, the http://site?k={searchterm}
just don't work, after I change "?"
to "#"
, it works great again.
I wonder what's the difference between #k=
and ?k=
, and which one is the correct syntax ?
Soluzione
I find this from one of the questions:
When a user insert a search query in the search box, this 'search word' is automatically added to the URL (for example: "results.aspx?k=word"
)
When the user inserts a new query, or will choose another search navigation item (for example 'People') this keyword is still in the url. So if he afterwards search for a second word, the URL become like "/results.aspx?k=word#k=second
"
search URL keyword parameter reset
Also Read the Comment from this blog, it will give you more information. https://blogs.technet.microsoft.com/tothesharepoint/2013/09/18/how-to-change-the-text-that-is-displayed-in-the-search-box-web-part-in-sharepoint-server-2013/