Created
September 5, 2014 19:58
-
-
Save blork/e2780fd7e2a1a95f57d3 to your computer and use it in GitHub Desktop.
iOS Extension Web Page Preprocessor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MyPreprocessor = function() {}; | |
MyPreprocessor.prototype = { | |
run: function(arguments) { | |
// Pass the baseURI of the webpage to the extension. | |
arguments.completionFunction({"URL": document.URL, "pageSource": document.documentElement.outerHTML, "title": document.title, "selection": window.getSelection().toString()}); | |
} | |
}; | |
// The JavaScript file must contain a global object named "ExtensionPreprocessingJS". | |
var ExtensionPreprocessingJS = new MyPreprocessor; |
nice code!
Is it a way to get the logo image source?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can access the info from Obj-C using the result dictionary, e.g.
results[@"pageSource"]
.(see https://gist.github.com/blork/3908619597ab4515941d)