14
$\begingroup$

So GitHub sent me on quite the journey, after it opened its desktop app from my browser. Copying the link I found something looking like: "github-mac://...".

I spent the next like 15 minutes trying to figure out how it did that and it turns out it does it via something called a "deep link", which it seems is basically a fancy link that the browser and OS have agreed to handle in a special way.

So does Mathematica support these?

$\endgroup$

2 Answers 2

14
$\begingroup$

As it turns out. Yes.

And there's an easy way to check (on Mac).

Check out this answer: https://stackoverflow.com/questions/49510/how-do-you-set-your-cocoa-application-as-the-default-web-browser/49512#49512

All we need to do is go to our application's info.plist and search for CFBundleURLName.

And what do you know? There's stuff there!

This is what I found there:

"wolfram+helpreference"

"wolframmathematica+helpreference"

"wolframmathematica+cloudobject"

"wolfram+cloudobject"

I dunno if this works for Windows or Linux, but for me this:

CloudExport["<a href=\"wolfram+helpreference://ref/Print\">link</a>",
 "HTML",
 Permissions -> "Public"]

Opens the Print ref page on my local machine. The wolfram+cloudobject version seems to import from a full cloud object URL (alas wolfram+cloudobject://www.google.com just beeps at me rather than importing the web page).

But this is (I think) definitively cool.

Now to scrape all my plists to see what other magic is out there...

$\endgroup$
0
0
$\begingroup$

It can be better.

In:

webpage = "<html>\n <head>\n <script type=\"text/javascript\">\n\
function load()\n\
{window.location.href=\"wolfram+helpreference://ref/Print\"}\n        \
</script>    </head>    <body onload=\"load()\">    </body></html>"
co = CloudExport[webpage, "HTML", Permissions -> "Public"];
List @@ co // First // SystemOpen
$\endgroup$
3
  • $\begingroup$ What does that do for us? Seems like just a standard Javascript way to get a CloudObject to auto-open a desktop link. (Although I don't see the point of the StringToString and ReadString pair, honestly). And you don't need RunProcess, unless it's something specific to your machine. Try SystemOpen. $\endgroup$
    – b3m2a1
    Commented Jun 1, 2017 at 14:38
  • $\begingroup$ So you don't have to click the link in the web page. The link is tiny. I read xs from a file before. I forgot to change it back. Yes, SystemOpen is better. $\endgroup$
    – webcpu
    Commented Jun 1, 2017 at 14:53
  • $\begingroup$ The idea with this is that you'll provide something other than that link for your users to click on a web page, not that you'll be doing this in the desktop. Like you make a standard HTML page, put in on the cloud, and somewhere you embed a wolfram+cloudobject:... link as an href. $\endgroup$
    – b3m2a1
    Commented Jun 1, 2017 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.