This question already has answers here:
Can I perform a DNS lookup (hostname to IP address) using client-side Javascript?
(16 answers)
Closed 4 years ago.
I need to check whether my email address has valid host, exist for example someone#yahoo.com might return valid meanwhile some#yahozzz.com might return invalid (because invalid host)
I stumbled upon a code in git for golang that satisfy my needs for that https://github.com/badoux/checkmail, but currently at the moment i'm looking for the solution in javascipt, any help will be appreciated.
P.S. : I am using this code as a script inside my HTML
Actually to verify that an email exists and is active you have to send a message to the email server and check the response.
That cannot be done entirely in javascript although you can rely on a service instead than on your backend like this
Related
This question already has answers here:
How to send an email from JavaScript
(20 answers)
Closed 4 years ago.
I have a problem. I want to put a contact form on the page, but I do not know how to do it in the Vue. I wanted to do it normally as jquery, php, but it does not work in Vue. Does anyone have an idea what I can do?
Vue is a View (hence the name) library, meant for describing your View layer i.e. how your application looks. Such logic as sending an email would for one be dependent on Javascript itself and not on Vue.
However it is not possible to send an email from Javascript in the browser. Instead you'd need to build a backend which can send an email for you, or you could call the user's email client, both described here.
You would ideally send email data (to, message body - html escaped of course) as a request to a backend end point and send from there. You can use Vue's HTTP resource to send the request: https://github.com/pagekit/vue-resource
But sending an email directly from Vue isn't possible.
This question already has answers here:
How to send an email from JavaScript
(20 answers)
Closed 7 years ago.
I am making a simple website, but to save I am making it send some text to an email using javascript.
I want to make it send directly, but if there is no way to do that it would be fine if it sends by going to the email site.
My code so far looks like this:
var a = function(){
var b = document.getElementById("email").value;
document.getElementById("textarea").value.mailto=b;
};
I want the code to send the value of the textarea.
You should have a server somewhere which listens to email sending commands. Your Javascript should send an AJAX request to that server, passing the necessary data and triggering the email sending functionality. The server, in turn should send the email(s) and respond to the Javascript part to notify the client-side whether it was successful.
This question already has answers here:
GEOIP and getting a computers IP address Location?
(7 answers)
Closed 8 years ago.
I want to fetch the city name where a visitor is accessing my website. i want to show some results according to the location(city name). I have tried so many codes but they were not fetching the correct city name.
programming Language: javascript or Php
Please help.
You can...
use the Geolocation API: http://dev.w3.org/geo/api/spec-source.html - Pro: very accurate. Con: the user has to allow the usage of his geolocation.
or you can use a service like http://www.ipinfodb.com/ip_location_api.php to get the location via IP. Pro: Works also with old browsers and without permission. Con: Inaccurate (the IP details don't point to the correct location in all cases).
There is two way to implement it. Either using javascript or php. The problem with javascript is all browsers does not support this feature and required client permission to trace location. If user does not want to share his location then javascript will prevent it.
So best way to use php and you can check out http://www.ipinfodb.com/ this url.
This is free ip db list and you can also find php api to implement it. You have to create free account on this site and get a api key and you can use php code like below
$location_str = file_get_contents("http://api.ipinfodb.com/v3/ip-country/?key=<your_api_key>ip=".$_SERVER['REMOTE_ADDR'] );
echo $location_Str;
you can replace 'ip-country' with 'ip-city' in url if you want city info.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Ways to circumvent the same-origin policy
i have this situation:
i have a form to be filled in my website, and in that form there is an input for a number that i have to check to see if it's a valid number or not.to check that this number is valid, there is another website and there is an input in that site which you can enter the number and if it is valid(it's registered in something) then it will show you the name of the person related to that number.
how can i do this...i wanna have a onBlur() function on the input in my website which do the trick for me, and if it's not valid alert it.
can you help?
btw, it's the website which checks if the number is valid:
http://portal.irimc.org/DoctorSearchEngine/Search.aspx
you enter a number(e.g. 12554) in the top input and it shows that it belongs to somebody and it's valid.
thanks.
It's impossible with client side javascript but possible with backend server support. From your website you get data from user and send with AJAX to your server, server load form from another website, fill it and get/parse response. Then return response for your Ajax request.
Read about sending POST/GET request's from server site.
Examples:
php - http://www.jonasjohn.de/snippets/php/post-request.htm
rails - http://blog.dougpetkanics.com/making-a-post-request-to-a-rails-api-endpoint
rails testing tool with webkit integration - https://github.com/jnicklas/capybara/
java - Is it possible to test Java application with Capybara?
See how easy is filling form with capybara:
def login!
within("//form[#id='session']") do
fill_in 'Login', :with => 'user#example.com'
fill_in 'Password', :with => 'password'
end
click_link 'Sign in'
end
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How to check if a page is exist or not using javascript
can you provide the code for checking the page exist or not.if not,it will redirect to another page.
The problem is, if the page doesn't exist (the server is given what it considers an invalid url that it cannot satisfy), you will get a 404 error. So no code on any target page is going to run. Instead you have to do this server side, specifying what page to serve instead when a 404 is encountered. It is not done with client-side javascript.