plugin that does not force rendering in a new NSView

  • Hi,

    I've created a plugin based on WebView for handling a particular mime
    type. This works fine except, I do not want to render anything in the
    browser - I just want to pass the url of the data to an external
    application, i.e. I would like the user to click on a link, and the
    external app to do its thing. Instead, because I'm subclassing NSView,
    the browser moves to a blank page (because I have nothing to render).
    Is there anyway to use the facilities of the WebKit without forcing me
    to render something?

    I've searched extensively and cannot find any docs on how this might
    be achieved. The Java Web Start  plugin does something similar to what
    I want. I've tried getting hold of a parent frame's history, and even
    tried writing out a script tag in order to try and get
    document.referrer, and then load the previous page in my WebView.

    Any help appreciated.

    Andrew
  • On 13.01.2008, at 16:11, Andrew Harrison wrote:
    > I've created a plugin based on WebView for handling a particular
    > mime type. This works fine except, I do not want to render anything
    > in the browser - I just want to pass the url of the data to an
    > external application, i.e. I would like the user to click on a link,
    > and the external app to do its thing. Instead, because I'm
    > subclassing NSView, the browser moves to a blank page (because I
    > have nothing to render). Is there anyway to use the facilities of
    > the WebKit without forcing me to render something?

      I think you don't need a WebKit plugin for that. From what I heard,
    you can just specify the URL scheme you want to handle in your app's
    Info.plist, and then it will be called upon automatically whenever
    URLs with that particular scheme are encountered.

    Cheers,
    -- M. Uli Kusterer
    "The Witnesses of TeachText are everywhere..."
    http://www.zathras.de
  • Hi,

    > On 13.01.2008, at 16:11, Andrew Harrison wrote:
    >> I've created a plugin based on WebView for handling a particular
    >> mime type. This works fine except, I do not want to render anything
    >> in the browser - I just want to pass the url of the data to an
    >> external application, i.e. I would like the user to click on a
    >> link, and the external app to do its thing. Instead, because I'm
    >> subclassing NSView, the browser moves to a blank page (because I
    >> have nothing to render). Is there anyway to use the facilities of
    >> the WebKit without forcing me to render something?
    >
    >
    > I think you don't need a WebKit plugin for that. From what I heard,
    > you can just specify the URL scheme you want to handle in your app's
    > Info.plist, and then it will be called upon automatically whenever
    > URLs with that particular scheme are encountered.
    >
    Thanks very much for your response. Indeed, I wrote an app using a
    custom URL scheme and adding the properties to the info.plist. It
    works great. But custom URL schemes should only be used if existing
    URL schemes do not satisfy: http://www.w3.org/TR/webarch/#URI-scheme

    HTTP is fine for my purposes. Hence I'm basing locating a local app on
    mime type. You can register mime and file extensions in the info.plist
    as well, but Safari won't open the app by default.

    I found a very similar question on the list from over 2(!) years ago: http://lists.apple.com/archives/webkitsdk-dev/2005/Apr/msg00011.html
      Unfortunately the thread fizzled out without a solution.

    I would settle for either for the good option - not opening the NSView
    and staying on the site where the user clicked - or the less good
    option - going back to where the user clicked. The former may be
    achievable with some cocoa magic. If I could get hold of the WebView
    containing the previous content on plugin initialization, I might be
    in with a chance as I could return this object to the system. But  I
    can't see how to get hold of another WebView from a WebView. The
    latter is tricky because getting hold of the browser's history seems
    almost impossible from Javascript. For example, Safari seems to create
    a frameset for plugin content. The frame that my content loads into
    contains a source attribute pointing to the url I'm after, but I can't
    get hold of it using usual Javascript techniques.

    Thanks,

    Andrew
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today