I have a web-page that has the "user-scalable" attribute of the viewport meta tag set to true (Safari reference, Android reference). So users with browsers that recognize the attribute (such as Mobile Safari, Android Browser) can pinch to scale the page. However, there is a link that refreshes most of the page using AJAX, but does not perform a full page refresh. I'd like to reset the viewport scaling to the initial value using JavaScript. But I can't figure out how to do this.
The only solution seems to be a full page refresh. Anyone know of a better way?
Thanks.
Pretty simple deal to set the viewport using jQuery:
$('meta[name=viewport]').attr('content', 'width=device-width, initial-scale=1');
This works on Mobile Safari using jQuery Mobile as a framework.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With