You can use the information about web browser contained in navigator object. The name and version are there.
var appname = window.navigator.appName;
Based on JavaScript Browser Detection
题
I have an UDID
retrieval website which is dedicated to iOS devices and must be opened in mobile safari to download .mobileconfig
profile.
I am after a php
or htaccess
code to force/ask user to open my website in mobile Safari.
Appreciate your help :)
解决方案
You can use the information about web browser contained in navigator object. The name and version are there.
var appname = window.navigator.appName;
Based on JavaScript Browser Detection
其他提示
This should be done with JavaScript. Create two div's. One with the mobile link to the profile and one that tells the user to open the site on their iOS Device. Then use JavaScript to show/hide them as necessary.
<script>
var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false );
if (iOS) {
document.getElementById("ifiOSHiddenDIV").style.display="true";
}
</script>
<!-- HTML-->
<div id="ifiOSHiddenDIV" />
Link to Mobile Provision
</div>
These links will also help:
Hide an html element using javascript only if browser is firefox