M
M
Millerish2017-08-26 00:11:51
JavaScript
Millerish, 2017-08-26 00:11:51

JS: How to get site name?

I have such typical addresses:
https://www.google.com.ua/images/branding/product/...
https://www.google.com/images/branding/product/ico...
https: //google.com/images/branding/product/ico/goo...
google.com/images/branding/product/ico/googleg_lodp.ico
www.google.com/images/branding/product/ico/googleg_lodp.ico
https://books.google.com.ua/images/branding/produc...
What function should be written to get only the site name - google in all cases?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2017-08-26
@Millerish

location .host won't work?
Demo

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question