You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

nautama

Trainee

  • "nautama" started this thread

Posts: 82

Location: La Paz, Baja California Sur, México

Occupation: KRpano programmer at www.imagen360.com

  • Send private message

1

Tuesday, June 30th 2015, 7:08pm

Targeting devices directly from the HTML?

Hello there, everyone, I hope you can lend me a hand on this one!

I have implemented media share buttons inside the HTML that contains the tour, they seem to work nicely (of course they go away when I go into fullscreen which is something I can live with) but I would only like them to appear on desktop devices, not tablet|mobiles. Currently they appear everywhere. A workaround I tried was to have a main HTML opening a "prexml.xml" file which basically just redirects and opens a new HTML like this:

Source code

1
<krpano onstart="if(device.mobile,openurl('index_mobile.html',_self); , openurl('index_desktop.html',_self););"/>


This seems to work but I think it's not a very good programming scheme and perhaps it can have security issues in some browsers. The point would be to have a way to target my <div> share buttons inside the main HTML and make them appear / disappear depending on the device at hand.

Any suggestions? *confused*