I used the following jquery to insert a metatag into a html document.
<script type="text/javascript">
if(screen.width>=320 && screen.width<=767){
$('head').append('<meta id="viewport" name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">');}
</script>
If possible, I'd like to insert the metatag without using jquery. Anyone have any ideas how I can do that?
I believe I will probably need to use document.getElementByTagName but I'm not sure how.
Just in case you are wondering, I am inserting the metatag into my html to to optomize the site for viewing with the iphone.
Unfortunately, width=device-width is not an option as it doesn't play well with my ipad version.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…