jQuery を書いていて、今まで動いてたのは、
HTML に、iframe タグ、src は適当に何かを指すようにしてあって、表示サイズを0
(=あえて、隠しておく)
<iframe id="otherframe" src="xxxx" width="0px" height="0px"></iframe>
何からのイベントで、load(function(){} )で、印刷プレビューを表示していたのですが、、
$('#otherframe').load(function(){ document.getElementById('otherframe').contentWindow.print(); });
このコード、jQuery 2.x 系では動いてたのに、3.x にしたら、
TypeError: e.indexOf is not a function
が発生
jQuery 3.0 で、load() イベントハンドラ関数は削除されてる!
.load() | jQuery API Documentation
対処として、以下のように、on('load', function(){}) で書けば、jQuery 3.3.1 でも動きます。
$('#otherframe').on('load', function(){ document.getElementById('otherframe').contentWindow.print(); });