How to add username to Chrome extension url?

I am working on a Chrome bookmark extension with the Google engine as a backend. I am the only user now, but I thought that if there are other users in the future, the url must include the username for the extension in order to interact with the backend. So I decided to change

http://ting-1.appspot.com/useradminpage 

to

 http://ting-1.appspot.com/user_name/useradminpage 

where "user_name" is the gmail user id.

But I looked at the twitter url and see what they have

 http://twitter.com/#!/user_name/ 

What is the purpose of "#!"? Is my circuit sufficient in this case?

+1
source share
1 answer

# in the URL means "fragment identifier". Historically, this was used to identify the part of the document identified by the anchor tag, but recently, webapp developers have begun to use it to transfer information about the state of the page to the Javascript code running on the page. This is used because Javascript code can change a fragment of the current page without forcing to reload the page - this means that it can be updated when viewing a web page and return to where you were when you reload the page.

The snippet is not sent to the server when the browser loads the page, so the Twitter server just sees the request for twitter.com; this is before the javascript code on the page to examine the fragment and determine what to do after that.

In your specific case, if you use the User Engine service to authenticate users, you have several options for how to distinguish users from your URLs:

  • Use your email address. Theoretically, this may change, and users may not want their addresses in the URL that they share. If the URLs are private, this is more or less a contentious issue.
  • Use your user_id. It is opaque and does not show any useful information about the user, therefore it is safe, but it is also pointless and difficult to remember.
  • Let users choose an alias for their URLs, such as Facebook and other services, on a first-to-first basis.
+2
source

Source: https://habr.com/ru/post/899665/


All Articles