0

I can't get Action Extensions to work with selected text in safari. Inside Activation rules there is the rule to allow text, but the extension is not available when I select the text.

AstroCB
  • 12,337
  • 20
  • 57
  • 73
Eric
  • 57
  • 6

1 Answers1

0

You need to turn on NSExtensionActivationSupportsWebURLWithMaxCount to make extension available in Safari.

When you create a non-UI action extension target from the template, an Action.js file is automatically created. Edit the file to send back the selected text using

document.getSelection().toString()
honcheng
  • 2,014
  • 13
  • 14
  • Did you try out this code? I've done exactly as described but document.getSelection().toString() always returns an empty string. (Returning other data from the javascript works as expected.) – Brett Hannah Oct 09 '14 at 07:09
  • Yup, this works for me. I have an app out that uses it. – honcheng Oct 29 '14 at 06:06
  • Would you be so kind to post some code? I can't get it to work. – Tom Mar 18 '15 at 12:05
  • @honcheng `I have an app out that uses it.` I would love to check your app out. Can you please post the link? – Matt Apr 02 '15 at 13:08