Code Monkey home page Code Monkey logo

Comments (2)

serbanghita avatar serbanghita commented on June 15, 2024

@bassjobsen sorry i wasn't able to reply fast because of the GitHub outage. The class as it is right now will never support this feature because it's very hard to classify all the devices details without calling an external API (database). I'm working on a free API, but this will be live after I release the 3.0.0 version.

Meanwhile I am creating a JavaScript script that correctly takes the viewport of a device a.k.a. max-width. This script will be useful if you are using AJAX to load all your scripts.

Thank you for using the class and for writing this, this helps me steer the Mobile_Detect class in the right direction!

I will close and watch this thread, feel free to continue the discussion.

from mobile-detect.

bassjobsen avatar bassjobsen commented on June 15, 2024

@serbanghita thanks for your response. I'm looking forward to your API and javascript solution.

Javascript can be used only when the page has rendered already. Maybe it will be possible to create a preloader.
B.e. store the max screen width in a session. If the session not exists, detect screen width and reload the page.

http://www.metaltoad.com/blog/simple-device-diagram-responsive-design-planning provides a nice diagram. The diagram shows you can only construct one breakpoint now. This also works only for iPhones. You will have small or big. iphone5 will break this too?

Now you can use:

function maxScreenLandscape()
{

    if($dectect->isIphone()) return 'small'; // or maybe 480
    return 'full'; // or maybe 960
}

When your api is ready you could maybe hardcode extend the function above.

Something like:

if( $dectect->isIphone() ||
($dectect->isAndroid() && $dectect->isHTC && !$detect->isTablet())
) 
{
return 'small'; // or maybe 480
}

from mobile-detect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.