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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -