Documentation
Here's how to launch the DNS Helper modal from your app
Including dnshelper.js
Use the following code to include the dnshelper.js script on each page
of your site that needs to use DNS Helper. Replace YOUR_API_KEY
with the
API key you were emailed after signing up.
dnshelper.js must always be loaded directly from https://js.dnshelper.com, rather than included in a bundle or hosted yourself.
<script src="https://js.dnshelper.com/v1?key=YOUR_API_KEY"></script>
Launching the Modal
Execute the following JavaScript code:
dnshelper(fqdn, type, value [, options])
Parameters
fqdn
-
The fully-qualified domain name of the DNS record that needs to be added, for example
shop.yourcustomersdomain.example
. The trailing dot is optional and will added automatically if omitted. type
-
The type of the DNS record that needs to be added. One of the following:
CNAME
MX
TXT
Email us if you are interested in other DNS record types.
value
-
The value of the DNS record that needs to be added.
-
For CNAME records: A string containing the fully-qualified domain name of the CNAME target, for example,
app.yoursaasdomain.example
. The trailing dot is optional and will added automatically if omitted. -
For MX records: An object containing the following properties:
fqdn
: A string containing the fully-qualified domain name of the mail server, for example,mx.yoursaasdomain.example
. The trailing dot is optional and will added automatically if omitted.preference
: An integer specifying the preference/priority of the mail server.
-
For TXT records: A string containing the value of the TXT record, without the enclosing double quotes. (If a DNS provider requires that long TXT records be specified as multiple strings, DNS Helper will automatically split this value.)
-
options
OPTIONAL-
An optional object containing any number of the following properties:
onsuccess
-
The action to take when the DNS record is successfully added. This can be:
- A string containing a URL which DNS Helper will redirect the user to
- A function which will be executed, after which the modal will close
null
(the default), in which case the modal will close
onclose
-
The action to take when the user closes the modal. This can be:
- A string containing a URL which DNS Helper will redirect the user to
- A function which will be executed, after which the modal will close
null
(the default), in which case the modal will close
onskip
-
The action to take when the record has not been added but the user clicks "Continue Anyways". This can be:
- A string containing a URL which DNS Helper will redirect the user to
- A function which will be executed, after which the modal will close
null
(the default), in which case the "Continue Anyways" button will not be shown