I have a website with thousands of pages with all kinds of things that can go wrong as technology and devices progress (www.toilette-humor.com). I need to add a link on every page that will allow users to "REPORT A PROBLEM". So I need to capture the following info and have it email off to me:
- What URL they saw the problem on
- What Browser and Version they are using
and if possible...
- What Operating System they are using
- What Platform/Device they are using
I have found some code here to answer the first issue of capturing the URL and putting it in the body of an email, AND I found some other code for capturing the browser and version, but that code doesn't add it to an email.
I know absolutely nothing about writing Javascript what so ever. So I ask you all, how can I combine the two scripts, or is there a better solution.
Script One (Captures URL and add's it to body of email) found here: How to write in 'mailto' body link to current page
<head>
<script>
function SendLinkByMail(href) {
var subject= "Report a Problem";
var body = "There is a problem with this webpage:\r\n\r\n<";
body += window.location.href;
body += ">";
var uri = "mailto:?subject=";
uri += encodeURIComponent(subject);
uri += "&body=";
uri += encodeURIComponent(body);
window.location.href = uri;
}
</script>
</head>
<body>
<p><a href="javascript:(function()%7BSendLinkByMail()%3B%7D)()%3B">Email link to this page</a></p>
</body>
Script Two (Captures Browser and Version) found here: How can you detect the version of a browser?
<script>
navigator.sayswho= (function(){
var ua= navigator.userAgent, tem,
M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*([\d\.]+)/i) || [];
if(/trident/i.test(M[1])){
tem= /\brv[ :]+(\d+(\.\d+)?)/g.exec(ua) || [];
return 'IE '+(tem[1] || '');
}
M= M[2]? [M[1], M[2]]:[navigator.appName, navigator.appVersion, '-?'];
if((tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
return M.join(' ');
})();
</script>
Thank you all in advance for your time and knowledge.