By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
SA Jobs SearchSA Jobs Search
  • Jobs
  • Employers/Agencies
  • Career Advice
    • Skills
    • News
  • NECTA Results
  • SA Articles
    • SASSA Updates
  • Scholarships
  • Technology
Search
© 2022 Foxiz News Network. Ruby Design Company. All Rights Reserved.
Reading: Select the type of mobile device
Share
Sign In
Notification Show More
Latest News
High Paying Jobs In Canada For Immigrants
Career Advice
AKA Accused Of Killing Nellie Tembe In Leaked Court Documents
AKA Accused Of Killing Nellie Tembe In Leaked Court Documents
Entertainment News
Vumoo: Free Movie Streaming
Tech Tips
What Are Basic Skills In Education | How to develop the 10 key skills you need to work in Education
Education, Colleges & Institutes
Is Capital Goods a Good Career Path?
Productivity
Aa
SA Jobs SearchSA Jobs Search
Aa
  • Home
  • Home
  • Home
  • Home
  • Jobs
  • Resume Home
  • Jobs
  • Jobs
  • Job Listing Home
  • Search Map Home
  • RecruitExpert Home
  • Career Home
  • Companies
  • Job Categories Home
  • Resumes
  • Candidate Home
  • #17001 (no title)
  • Pages
  • Hiring Home
  • Jobs
  • Style 1
  • Style 2
  • Style 3
  • Style 4
  • Companies
  • Companies
  • Resumes
  • Resumes
  • Jobs
  • Pages
  • Pages
  • Style 1
  • Style 2
  • Style 3
  • Style 4
  • Companies
  • Companies
  • Resumes
  • Resumes
  • Pages
  • Pages
Search
  • Disclaimer
  • About Us
  • Privacy Policy
  • Contact Us
Have an existing account? Sign In
Follow US
© 2022 Foxiz News Network. Ruby Design Company. All Rights Reserved.
Education, Colleges & Institutes

Select the type of mobile device

Admin
Last updated: 2021/12/06 at 3:47 AM
Admin
Share
SHARE

In the contact page example, and in the following code sample, you see how to check the user agent for key terms that indicate which type of browser is being used to visit your site. The user agent, which is sent with the request from a browser to a web server, is a text description that identifies the browser version and operating system.
Here’s the current user agent for an iPhone:
Mozilla/5.0+(iPhone;+U;+CPU+iPhone+OS+4_3_2+like+Mac+OS+X;+en-us)+AppleWebKit/533.17.9+(KHTML,+like+Gecko )+Version/5.0.2+Mobile/8H7+Safari/6533.18.5
Here’s the user agent for an iPad:
Mozilla/5.0+(iPad;+U;+CPU+OS+4_3_2+like+Mac+OS+X;+en-us) +AppleWebKit/533.17.9+(KHTML,+like+Gecko)+Version/5.0.2+Mobile/8H7+Safari/6533.18.5
You insert the following code into your web page to detect the user agent and deliver the optimized version of the page to each device. (Note that the line numbers on the right aren’t a required part of the code. They’re included only for your reference as we examine a few lines of code in detail in the next paragraph.)
The following list explains what’s happening in the preceding code block:
Line 1: Tells the web server to process the following as PHP code before sending the page to the browser.
Line 2: Retrieves the user agent from the browser’s request for this page. You create a variable named $ua and assign it the value of $_SERVER[‘HTTP_USER_AGENT’. Now the variable ($ua) has the value of the user agent string. If an iPhone visited the site, $ua would have the value of the iPhone user agent.
Line 3: Creates a variable named $iPhone. Then using the function strpos(), PHP finds the position of “iPhone” in $ua and assigns its starting position to $iPhone.
$iPhone = strpos($ua,”iPhone”);
If $ua doesn’t contain “iPhone” strpos() returns FALSE. Later in the page, you can recognize whether a iPhone is requesting a page by testing the value of $iPhone.
Lines 4, 5, 6: Detect other systems in the same way as Line 3.
 

You Might Also Like

What Are Basic Skills In Education | How to develop the 10 key skills you need to work in Education

Ardhi University (ARU) Entry Requirements 2022-2023

FORM FIVE SELECTION 2022-2023

Fluoxetine Side Effects in Females

TAGGED: best way to detect mobile device, detect mobile device javascript 2022, detect mobile device php, get device type from user agent, how to detect mobile device javascript, javascript detect device type, javascript detect mobile or tablet, phone device type means, Select the type of mobile device

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
[mc4wp_form]
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share this Article
Facebook Twitter Copy Link Print
Share
Previous Article How Boot Camp Works on Your MacBook
Next Article Mobile device security overview with client-based applications
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

248.1k Like
69.1k Follow
134k Pin
54.3k Follow
banner banner
Create an Amazing Newspaper
Discover thousands of options, easy to customize layouts, one-click to import demo and much more.
Learn More

Latest News

High Paying Jobs In Canada For Immigrants
AKA Accused Of Killing Nellie Tembe In Leaked Court Documents
AKA Accused Of Killing Nellie Tembe In Leaked Court Documents
Vumoo: Free Movie Streaming
What Are Basic Skills In Education | How to develop the 10 key skills you need to work in Education
//

We influence 20 million users and is the number one business and technology news network on the planet

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

[mc4wp_form id=”1616″]

SA Jobs SearchSA Jobs Search
Follow US

© 2023 SA Jobs Search. All Rights Reserved.

Removed from reading list

Undo
Welcome Back!

Sign in to your account

Register Lost your password?