Feature detection solution for window.print() JavaScript

江枫思渺然 提交于 2019-12-01 16:25:21
jinglesthula

This question is indeed a duplicate of Determine whether browser supports printing. See carpetsmoker's comment on this question and the answer referred to. I agree, that may be the best we can do for now.

Even if window.print isn't part of any standard, it'd be nice if browser vendors implemented and agreed upon some API for detection. Perhaps they're all internally working on an appropriate implementation for the function and so don't want to throw out there something temporary that'll be useless later. Oh, well.

rahulroy9202

Updated

Try this:

function supportPrint() {   
     return (typeof(window.print) === 'function');
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!