LoginSignup
5
5

More than 5 years have passed since last update.

WebPayのCheckoutHelperを呼び出してるページで user-scalable=no が効かない

Last updated at Posted at 2014-11-12

現象

ページ中で以下のようなコードを書けばWebPayを簡単に使うことができますが、これを書くと
metaタグでuser-scalable=noを指定しているスマートフォン対応ページでも拡大縮小出来てしまうという問題が起きました。

<form action="/purchase" method="post">
  <script src="https://checkout.webpay.jp/v2/" class="webpay-button" data-key="your_key" data-lang="ja"></script>
</form>

原因

どうやら、https://checkout.webpay.jp/v2/ のスクリプトによって width=device-width, initial-scale=1のmetaタグが追加されてしまい、headタグで指定している方が効いていないらしい。

対処法

webpayのスクリプトを呼び出した直後にmetaタグで指定し直すことで拡大縮小できなくなります。後に指定したmetaタグの方が有効なんでしょうか。ものすごく行儀が悪い気がしますが…。

<form action="/purchase" method="post">
  <script src="https://checkout.webpay.jp/v2/" class="webpay-button" data-key="your_key" data-lang="ja"></script>
  <meta name='viewport' content='initial-scale=1.0, user-scalable=no'>
</form>
5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5