I need to handle HTTP URLs that begin with a certain domain with my app, because it points to a REST source. The web service however is not under my control, so i can't easily introduce a custom url scheme to open the links with my app.
Is there a way to intercept and handle such URLs in a Cocoa app?
Example: http://static.domain.name/some/random/path
My app should handle all links pointing to http://static.domain.name
I'm afraid that the answer will be NO, but hey, everything is possible somehow :).
Update
This is the Safari extension code i used to make it work (content in <> replaced with your stuff)
var allLinks = document.links;
for (var i=0; i<allLinks.length; i++) {
var link = allLinks[i];
if (/.*<match>.*/.test(link.href)) {
var rewrite = link.href.replace(/<match>/, "<customscheme>://");
link.href = rewrite;
console.log("Rewrote: " + rewrite);
}
}