/// PageUserScript uses the platform-appropriate WKUserScript initializer to create a user script in WKContentWorld.page
class PageUserScript: WKUserScript {
    override init(source: String, injectionTime: WKUserScriptInjectionTime, forMainFrameOnly: Bool) {
        if #available(iOS 14.0, *) {
            super.init(source: source, injectionTime: injectionTime, forMainFrameOnly: true, in: WKContentWorld.page)
        } else {
            super.init(source: source, injectionTime: injectionTime, forMainFrameOnly: true)
        }
    }
}

class PageUserScript: WKUserScript {
    override init(source: String, injectionTime: WKUserScriptInjectionTime, forMainFrameOnly: Bool) {
        if #available(iOS 14.0, *) {
            super.init(source: source, injectionTime: .atDocumentStart, forMainFrameOnly: true, in: WKContentWorld.page)
        } else {
            super.init(source: source, injectionTime: .atDocumentStart, forMainFrameOnly: true)
        }
    }
}

--- 
+++ 
@@ -1,9 +1,10 @@
+/// PageUserScript uses the platform-appropriate WKUserScript initializer to create a user script in WKContentWorld.page
 class PageUserScript: WKUserScript {
     override init(source: String, injectionTime: WKUserScriptInjectionTime, forMainFrameOnly: Bool) {
         if #available(iOS 14.0, *) {
-            super.init(source: source, injectionTime: .atDocumentStart, forMainFrameOnly: true, in: WKContentWorld.page)
+            super.init(source: source, injectionTime: injectionTime, forMainFrameOnly: true, in: WKContentWorld.page)
         } else {
-            super.init(source: source, injectionTime: .atDocumentStart, forMainFrameOnly: true)
+            super.init(source: source, injectionTime: injectionTime, forMainFrameOnly: true)
         }
     }
 }
Fix WKUserScript bug caused by not passing injection time to super.init
