Android – how to adjust the HTML / CSS layout of the browser in the instagram application?

I've been searching in Google, but I can't find the clue to my problem. I have a small website (HTML / CSS only), which looks good on mobile chrome. But there is a problem with padding in the instagram app browser on Android 5.0. Is there a way to deal with the app browser through media query or prefix? So far, I have got nothing. I hope someone can help me. Thank you in advance

PS: sorry, my English is not good. I'm trying

You can use JavaScript to detect the user agent containing instagram and request specific CSS for the case

Example code:

<script>
var isInstagram = navigator.userAgent.match(/instagram/i);
if (isInstagram) {
  var head = document.querySelector('head');
  var link = document.createElement('link');
  link.rel = 'stylesheet';
  link.href = 'your-file-with-instagram-fixes.css';
  head.appendChild(link);
}
</script>

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>