Skip to content

Commit

Permalink
Check for click handler on printing user script
Browse files Browse the repository at this point in the history
  • Loading branch information
alistairjcbrown committed Nov 10, 2021
1 parent 41c525c commit 5549a09
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions DuckDuckGo/BrowserTab/Model/PrintingUserScript.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ public class PrintingUserScript: NSObject, UserScript {
public var source: String = """
(function() {
document.addEventListener("click", function(event) {
event = event || window.event;
let onClickAttribute = event.target.getAttribute('onclick');
if (onClickAttribute.includes('window.print()')) {
if (onClickAttribute && onClickAttribute.includes('window.print()')) {
webkit.messageHandlers.printHandler.postMessage({});
}
});
Expand Down

0 comments on commit 5549a09

Please sign in to comment.