9 Replies Latest reply: Apr 11, 2012 5:02 PM by areohbee RSS

    is it possible to attach URLHandler for plugin

    Taehoon Koo Community Member

      Hi, Guys.

       

      I notice Facebook plugin can accept external URL protocol via web browser.

      ( URL : lightroom://com.adobe.lightroom.export.facebook/%23access_token=147.... )

       

      Screen shot 2010-11-16 at 1.39.59 AM.png

       

       

      Is it possible to attach Custrom URLHandler for my plugin ?

       

      I can't find any information about it.

       

      If someone know about this, please let me know.

       

      Have a nice day.

        • 1. Re: is it possible to attach URLHandler for plugin
          areohbee Community Member

          I don't see how.

           

          I mean Lr does not allow low-level access to internet communications, and otherwise what you get is:

           

          LrFtp, and

          LrHttp.

           

          If you cant do it with those, then you cant do it, or at least not directly...

           

          One thing you can do is talk to an external app. So what you could do is write the protocol handler as an external app, and then to send information from a plugin via the custom internet protocol, write a file or pass parameters to the external app. To receive, you could read a file written by the external app.

           

          Thats about all I can think of at the moment.

           

          Well maybe one other idea: use an http wrapper to access a web-app to tunnel, instead of a reglar app.

           

          Rob

          • 2. Re: is it possible to attach URLHandler for plugin
            johnrellis CommunityMVP

            Rob just pointed out that LR 3 does now support URL handlers:

             

            http://regex.info/blog/2012-01-17/1926

            • 3. Re: is it possible to attach URLHandler for plugin
              jarnoh Community Member

              It's not documented in SDK, but I've tried it before.

               

              In Info.lua:

               

              URLHandler = "URLHandler.lua",

               

              In URLHandler.lua (or whatever you want), just:

               

              local handler={}

              function handler.URLHandler(url)

              -- handle url here

              end

              return handler

               

              BTW I also tried this for external app communication, but for that specific purpose it was not suitable, because Lightroom takes focus when URL is clicked from browser.

              • 4. Re: is it possible to attach URLHandler for plugin
                Matt Dawson Community Member

                Just be sure that your code allows for the URL received being surrounded in

                double quotes. Not exactly sure the circumstances/platforms that trigger

                the issue but it is worth catering for it or you could end up with some

                very hard to reproduce bugs being reported.

                 

                Thanks,

                Matt

                • 5. Re: is it possible to attach URLHandler for plugin
                  Don McKee Community Member

                  This seems to work fine on my Win XP system running Firefox as my system default browser.  If I use IE 8, instead, I get an "Internet Explorer cannot display the webpage" diagnostic page when it gets handed my "lightroom://...." callback URL.  Does this mechanism work with IE?  Is it because IE wasn't my default browser when Lightroom was installed?

                   

                  -Don

                  • 6. Re: is it possible to attach URLHandler for plugin
                    Matt Dawson Community Member

                    Hi,

                     

                    I am wondering if there is some security or privacy setting that is

                    stopping IE from responding to the callback? A quick way to check would be

                    to temporarily add the originating site to your trusted site zone to see if

                    it works then.

                     

                    On Chrome you are prompted the first time to see whether you want to accept

                    URLs with this protocol. I'm guessing this is IE's way of handling the same

                    question.

                     

                    Thanks, Matt

                    (Apologies for the brevity - sent from my Android)

                    • 7. Re: is it possible to attach URLHandler for plugin
                      areohbee Community Member

                      Seems to work just fine if you just permanently dismiss the dialog box, e.g. IE.

                       

                      I've used this technique in my new cookmarks plugin:

                       

                      http://www.robcole.com/Rob/ProductsAndServices/CookmarksLrPlugin

                      • 8. Re: is it possible to attach URLHandler for plugin
                        Don McKee Community Member

                        The "lightroom://..." URL works fine in IE if I type it on the address bar, but it doesn't work (i.e. "Internet Explorer cannot display the webpage" error) if it comes in from the internet via an HTTP 302 redirect response.  Per Matt's suggestion, I added the originating site to my "trusted sites" (and even threw in my "lightroom://..." URL for good mesasure), but still no joy.  I guess Rob is having success driving his plug-in from IE, because his stuff is all local (right, Rob?).

                         

                        So, I'm still curious if anyone has had success using IE to respond to the "lightroom://..." protocol (or any custom protocol, for that matter) when the request originated from the internet.  Anyone?

                         

                        -Don

                         

                        (p.s., if anyone's curious, here's a page describing how custom protocols are registered on Windows systems: http://msdn.microsoft.com/en-us/library/aa767914%28v=vs.85%29.aspx .  )

                         

                        Update: Using IE, I discovered that if a user clicks on a link in a remote web page that has a "lightroom://..." URL, or the remote web page contains a

                         

                        <META HTTP-EQUIV="refresh" CONTENT="0;URL=lightroom://... />

                         

                        tag, it works.  IE (8 -- haven't tested others) is only choking on the HTTP 302 redirect.  :-(

                         

                        Message was edited by: Don McKee.  Added update.

                        • 9. Re: is it possible to attach URLHandler for plugin
                          areohbee Community Member

                          Don,

                           

                          Thanks for the link.

                           

                          Yeah - I have had no problems in IE when clicking on links via internet supplied web pages, once Lightroom has been approved as the URL handling agent. Never tried a redirect.

                           

                          I mean, lightroom:// links are neither local nor remote per se - or should I say they are always "local"...

                           

                          Rob