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.

1

Thursday, September 23rd 2010, 8:58pm

Script to hide the html code if not iphone browser

Hi, Klaus

I want to hide the html code of my index iPhone, iPod or iPad, when it's open with a no browser iPhone, iPod or iPad
possible ?! !. . .
I test many things, but I don't get it

Thank's for your great work

Regards

2

Monday, September 27th 2010, 11:16am

Hi, sorry, but how do you mean that?
what html code should be hidden?

3

Monday, September 27th 2010, 1:12pm

HI, Klaus

I want to hide the html code of the index (iPhone) or open a error page (Oups ! ! you need a iPhone, iPod or iPad to read this page), when you open this index with safari, ie or firefox

Sorry for my bad english

4

Monday, September 27th 2010, 4:45pm

Hi,

you mean you want a page only for the iphone, or?

you could do that in javascript and check for the current useragent,
e.g.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var ua = navigator.userAgent.toLowerCase();
		
if(ua.indexOf("ipad") >= 0 || ua.indexOf("iphone") >= 0 || ua.indexOf("ipod") >= 0)
{
  // ... iphone/ipod or ipad
  // e.g. do the krpano embedding script code
  var viewer = createswf("krpano.swf");
  viewer.addVariable("xml","krpano.xml");
  viewer.embed("krpanoDIV");
}
else
{
 // anything else
 // e.g. write some text into the krpanoDIV element
  document.getElementById("krpanoDIV").innerHTML = 'error:<br>no iphone/ipad/ipod';
}


best regards,
Klaus

5

Monday, September 27th 2010, 5:02pm

Hi, Klaus

Yes I only want a index for iPhone,iPod and iPad

I try to put your code but not working, perhaps I make a error in the index

6

Monday, September 27th 2010, 6:02pm

Did you surround that code by script tags?



<script language="JavaScript" type="text/javascript">
//<!--<[CDATA[

var ua = navigator.userAgent.toLowerCase();

if(ua.indexOf("ipad") >= 0 || ua.indexOf("iphone") >= 0 || ua.indexOf("ipod") >= 0)
{
// ... iphone/ipod or ipad
// e.g. do the krpano embedding script code
var viewer = createswf("krpano.swf");
viewer.addVariable("xml","krpano.xml");
viewer.embed("krpanoDIV");
}
else
{
// anything else
// e.g. write some text into the krpanoDIV element
document.getElementById("krpanoDIV").innerHTML = 'error:<br>no iphone/ipad/ipod';
}


// ]]> -->
</script>

8

Friday, October 1st 2010, 8:38am

Hi,
I try to put your code but not working, perhaps I make a error in the index
please show your html or a link to it?

best regards,
Klaus

9

Friday, October 1st 2010, 9:13am

Hi, Klaus

It's working now, thank's *thumbsup*