if (!empty($_SERVER['HTTP_CLIENT_IP']))
$ip=$_SERVER['HTTP_CLIENT_IP'];
else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
else
$ip=$_SERVER['REMOTE_ADDR'];
?>
Based on recent community feedback, we noticed that many developers are unclear about how ZK supports mobile applications. Let’s take a look at how it works:
ZK’s Approach in One Sentence
ZK enables you to build one web application that works across desktop and mobile devices, instead of maintaining separate codebases.
What This Means in Practice
With ZK:
You don’t build a separate mobile app
You adapt your UI for different screen sizes
You reuse the same backend and components
Techniques include:
Responsive layouts
Device-specific templates
Simplified mobile views
“Is This a Native Mobile App?”
No. ZK applications are web-based.
However, you can still achieve app-like experiences using:
Progressive Web Apps (PWA)
Embedding in native WebViews
Why We Chose This Approach
In many enterprise scenarios, the biggest challenge is not building the first version — it’s maintaining multiple versions over time.
By using a single codebase:
Development is faster
Maintenance cost is lower
Features stay consistent across devices
Approach
Web
Mobile/Tablet
Maintenance Effort
ZK
Single codebase
Responsive / templates
Low
Client side, for example React + React Native
Separate
Separate
Higher
Native
Not supported
Works well
Highest
When You Might Still Need Native
If your application requires deep device integration or high-performance graphics, then a native app may still be the right tool for the job.
Now that we understand why we follow this single codebase approach. Building on this architecture, ZK offers integrated features that further improve the mobile user experience.
Built-in Mobile Enhancements
ZK not only enables a single codebase approach but also provides built-in features to improve the mobile user experience.
Touch Event Support ZK supports common touch interactions such as tapping, swiping, and scrolling, allowing applications to work naturally on touch-enabled devices without additional libraries.
Mobile-Optimized Components (ZK EE) In ZK Enterprise Edition, certain components automatically adapt to mobile usage patterns. For example, input components such as time selection may switch to mobile-friendly interfaces like spinning wheels, providing a more intuitive experience on smaller screens.
These enhancements allow developers to deliver mobile-friendly behavior while continuing to use the same components and programming model.
Summary
ZK supports mobile without requiring you to duplicate your application into another technology stack. Instead, it helps you extend your existing web application to mobile devices efficiently and sustainably.
References and Next Steps
To implement mobile-friendly applications with ZK, you can explore the following topics: