开发者

Sending an email with browser capabilities and screen size etc

开发者 https://www.devze.com 2023-01-01 06:25 出处:网络
A lot of my visitors are blind (with it being a site for the blind), and often when trying to diagnose problems, I\'d like to know what version of browser etc they\'re using, whether flash is installe

A lot of my visitors are blind (with it being a site for the blind), and often when trying to diagnose problems, I'd like to know what version of browser etc they're using, whether flash is installed. Because more often than not, someone will swear they are using X, when in fact Y is installed. Currently, I'm using http://jsbrwsniff.sourceforge.net/usage.html piped into an email, but I've got 2 problems here:

First of all, jsbrwsniff is quite "heavy" and hasn't been updated since early 2007, so there's a lot of -1's in the result.

Secondly, if I call it as follows, the page reloads:

<a href="#" onclick="sendEmail()">Email feedback</a>

And if I call it like this, the page goes blank and looks like it's trying to infinitely load a blank page:

<a href="javascript:sendEmail()">Email feedback</a>

See the nightmare for yourself here: http://kingston.talking-newspapers.co.uk/

Now, I know there are 1001 articles and comments here and elsewhere saying "don't use browser sniffers, they can be spoofed (etc)", but honestly, you'll have to trust me that this is a significantly useful tool when you're talking someone in their more "senior years" and using a screenreader through "help > about", when they've clicked the wrong window to start with!

I'm using jquery anyway in the site, and I'm aware of $jQuery.browser and $jQuery.support, but these don't tell me the elements I need (like whether Flash is installed, and what version etc). I've looked everywhere for a jquery plugin for my needs, with no luck.

Finally, if I have to stick to the current method of jsbrwsniff then it's not the end of the world, but if anyone knows a way of launching the user's email client populated with the information I need but WITHOUT refreshing or blanking the page, I'd love to kno开发者_如何学Gow.

BTW - there's a good reason for not using a webform, which is simply because it's easier for the screen-reader user to use an email client they are used to.

Thanks!


Tthat E-Mail should definitely be sent from the server side IMO.

You could make an Ajax request containing all the information you are sniffing to a PHP or other server side script. That script would receive the data and send the E-Mail. It's much more reliable that way.

Other than that, can you emphasize your exact question - is it the sniffing part, or the sending part...?


When the user want's to submit the browser details, you could dynamically create a form (e.g. in a hidden DIV) that contains all the deails you need and inoke the users email client by using a mailto: action URL. For details, see http://www.javascript-coder.com/javascript-form/javascript-email-form.phtml

But I'm not sure how to get the mail automatically sent. That would seem to transcend the security of the browser. So, your users will still have to click send.


Have you considered using mailto: to open the mail client and get the collected information into an email?

I'm not sure if your jquery can format the information you collected into a href link, but if so something like this may be what you're looking for:

<a href="mailto:someone@somewhere.com?subject=This%20is%20the%20subject&cc=someone_else@example.com&body=This%20is%20the%20body">mail</a>

0

精彩评论

暂无评论...
验证码 换一张
取 消