android - JavaScript determine the device, and add image to message.confirm -
i trying find out device (android/iphone/pc etc...) user viewing site on, if on android want give them option download android app, , if on iphone give them option download iphone app.
i have works android:
// javascript document var ua = navigator.useragent.tolowercase(); var isandroid = ua.indexof("android") > -1; //&& ua.indexof("mobile"); if(isandroid) { if (window.confirm("would download, app_name android app")) { // redirect android-site? window.open("https://play.google.com/store/app_url_here", "re-directing android store!"); } }
questions: can add image window.confirm box, , how.
is correct way doing this, if not can suggest better way.
thanks
g
confirm
, alert
simple, in-built functionality not suitable more simple string... i'd suggest building modal
of sort if want prompt user more elegance.
a simple div, positioned absolutely in center of device, nice border , drop-shadow seems trick.
Comments
Post a Comment