Copy link to clipboard
Copied
I am making an element in Animate CC (html5 canvas) that will be integrated in an html5 page with WordPress.
This element contains a navigation bar. Apparently this navigation bar looks to small when displayed on mobile phones.
I can tell it to be bigger depending on the width of the window, but that's in pixels and a "normal" display in desktop browsers uses less pixels than a very small display on mobile phones. They use different DPI.
I tried to use "Capabilities.screenDPI" but Html5 Canvas doesn't seem to recognize this command.
Bottom line - How can I get the actual display size, in inches or millimeters?
Note: I am an animator, not a programmer. I'm doing this in AS3 and learning it as I go but advanced JS is beyond my skill set...
1 Correct answer
Never mind, I figured it out....
I used: "window.devicePixelRatio".
Copy link to clipboard
Copied
you can use navigator.mimeTypes:
if(navigator.mimeTypes["application/x-shockwave-flash"]==undefined){
// it's probably a mobile
}
Copy link to clipboard
Copied
I need not only to know IF it's a mobile, but to know the size itself, so I can know by what number I should scale the navigation bar.
I'm googling so many optional expressions (screenDpiX, devicePixelRatioX, canvas.screenResolutionX and what not...) - none of them seems to give me what I need (or at least be recognized by html5)
Copy link to clipboard
Copied
Never mind, I figured it out....
I used: "window.devicePixelRatio".

