问题
I've been googling a lot, but found no clue for my problem. I have a tiny website (html/css only), that's looks nice on mobile Chrome. But on instagram in-app browser on Android 5.0 somethings goes wrong with paddings. Is there any way to deal with in-app browsers through media-queries or prefixes? So far I've found just nothing. Hope here someone could help me. Thanks in advance.
P.S. Sorry for my poor English, I am working on it.
回答1:
You can use JavaScript to detect the user-agent which includes Instagram
and request a specific CSS for that 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>
来源:https://stackoverflow.com/questions/40926277/how-to-adjust-html-css-layout-for-instagram-in-app-browser