IPhone browser tag and optimized website

What is an iPhone browser tag and how is an iPhone-optimized website different from a regular mobile website?

Thank!

+3
source share
4 answers

Nettuts has a great understanding of web development for the iPhone. You will find here

This is the specific code you asked for (taken from this article):

<!--#if expr="(${HTTP_USER_AGENT} = /iPhone/)"-->   

<!--  
place iPhone code in here  
-->   

<!--#else -->   

<!--  
    place standard code to be used by non iphone browser.   
-->   
<!--#endif --> 
+1
source

Apple has great guidelines for developing iPhone web pages here:

Safari Web Content Guide for iPhone

From my brief introduction to this, here are the key elements to look for:

  • - . META, , - .
  • , , , iPhone .
  • , iPhone, META, 53x53, , favorite.ico.
  • javascript, , , iPhone.
  • CSS, iPhone.
  • HTML/Javascript, , .
+2

Apple defines the user agent here .

This field is transmitted in the HTTP headers under the "User-Agent" key.

+1
source

The best decision:

*

  (NSString *)flattenHTML:(NSString *)html {

  NSScanner *theScanner; NSString *text = nil;

  theScanner = [NSScanner scannerWithString:html];

  while ([theScanner isAtEnd] == NO) {

  // find start of tag
  [theScanner scanUpToString:@"<" intoString:NULL] ; 


  // find end of tag
  [theScanner scanUpToString:@">" intoString:&text] ;


  // replace the found tag with a space
  //(you can filter multi-spaces out later if you wish)
  html = [html stringByReplacingOccurrencesOfString:
                     [ NSString stringWithFormat:@"%@>", text]
               withString:@" "];

  } // while //

  return html;

}

0
source

Source: https://habr.com/ru/post/1696761/


All Articles