My webpage has absolutely no "meta" view tag.
I created my own "meta" view tag dynamically:
var viewportMeta = document.createElement('meta'); viewportMeta.setAttribute('id', 'myMeta'); viewportMeta.setAttribute('name', 'viewport'); viewportMeta.setAttribute('content', 'width=device-width, initial-scale=1.0, user-scalable=no');
and added it to "head" (after some user actions):
document.head.appendChild(viewportMeta);
Then (after the user clicks on some button) I need to remove the tag "myMeta" "meta" from "head":
var myMeta = document.getElementById('myMeta'); document.head.removeChild(myMeta);
And he removes, 100%! Tested with a desktop browser and Adobe Edge Inspect Weinre on iPad.
But the whole page does not go back to the previous state! The whole page remains unchanged, for example, it has a βmetaβ viewport tag with all the defined properties in the viewportMeta object.
So, is there a way to completely remove the "meta" viewport tag? Any ideas?
(This issue affects the iPad Safari and Chrome browsers. I tried not to remove the "meta" tag, but just changed its "content" property - it failed. I did not check it on Android devices and browsers.)
source share