swift - Accessing the Javascript of the active Safari page in an extension? -
i want create extension simple goal of reading , modifying javascript of active page in safari. example if load page , javascript of page sets value of specific textfield "hello world" want read javascript, identify text field , modify fields value "hello world - modified" , have page display updated value. have read through of apples documentation couldn't find examples of trying achieve.
override func toolbaritemclicked(in window: sfsafariwindow) { window.getactivetab { (activetab) in activetab?.getactivepage(completionhandler: { (activepage) in //the following below example used in apples documentation activepage?.dispatchmessagetoscript(withname: "example", userinfo: nil) }) } }
instead of:
activepage?.dispatchmessagetoscript(withname: "example", userinfo: nil)
i need reading in javascript of activepage can identify text field looking , modify value. although modifying page in real time security concern, personal project , not public use.
Comments
Post a Comment