Jump to content
Larry Ullman's Book Forums

Recommended Posts

What is the best way of getting country name from the visitors and the average accuracy as i know 99% accuracy is on pay versions. And to use the country name we get from the visitor to allow to show a comment box if the page supposed to be accurate.

 

Thanks a bunch and waiting for. An answer

Link to comment
Share on other sites

You could look at some Javascript libraries. Geolocation is maybe something you could look into. When you have an exact location, country names are no issue. On another note, setting a country is maybe something your users won't be really hesitant to share with you directly? You could consider implement a splash screen version asking visitors their country.

 

Another way is maybe to look up their IP-adress. As this tread says, looking up IPs might be a way to go. Keep in mind that a user might sit behind a proxy, though, so that's not a guaranteed way to get their country...

 

... And that's also pretty much the point here. You cannot guarantee 100% a user's country, so I would recommend you to think about what suit your needs. Asking the user directly might get you more a better answer than looking up the IP, but social "cleverness" like asking their language might be even more accurate. It all depends on how import an exact location is to you.

  • Upvote 1
Link to comment
Share on other sites

As an American that lived in Japan for a long time, I fully agree with Antonio that it's better to ask than to assume.

For the sake of a selection, if you want to default to something based on an educated guess, that's fine, but whatever you do, make it easy and obvious to switch the country/language at any time.

Link to comment
Share on other sites

  • 2 weeks later...

Dear all Helpfull peoples,

 

thank you a lot for your reply's. actualy i wanted it some way to get from them by asking or automatic doesnt matter. because i wanted the login user to be controlled by their country. eg: i have 3 pages; 1-Maldives, 2-United Kingdom, 3- Netherlands and if a user login is currenly in Maldives than that he can only do posting in the Page Name Maldives but he can view all the other 2 pages, and if he travels to United Kingdom then he can post only the page Name United Kingdom but he can view the other 2 country pages. please advice me how can i develop this as i am very new for cording and web developing, but very keen to learn and wish to build it my self.

 

thank you and best regards

Link to comment
Share on other sites

I have two comments:

  1. I wouldn't restrict people to a particular page based on their location. Users generally don't like that.
  2. It sounds to me like you need to practice the basics a lot more before you can do what you want. I highly recommend going all the way through the book this board is for, and then coming back for advice once you have the basics.

 

Thanks.

Link to comment
Share on other sites

  • 1 month later...

thank you very much all. i have found a method that suites me. can any one help me in this Javascript issue.

 

 

 <script language="Javascript"> 
document.write("Welcome to our visitors from "+geoplugin_countryName()); 
  </script>

 

    <input class="form-control" id="disabledInput" type="text" placeholder="Disabled input here..." disabled>
 
i wanted the show the "Bold" result to show inside the "placeholder"
Link to comment
Share on other sites

 Share

×
×
  • Create New...