I'm using a Homepage Component to make an AJAX request from the built-in "Send an Email" to a Visualforce page I have written. The Visualforce page then returns JSONP for the original page to use.
The setup is working fine in general. However, when an admin user has Development Mode enabled, Salesforce is injecting HTML (presumably the Development Mode bar) into the Visualforce page. This is breaking my JSONP and causing some browsers to crash when they request it.
I see a couple of possible solutions to this problem.
The ideal would be if there were some way to prevent Salesforce injecting this code into my Visualforce page, however I have not come across a way to do that.
Alternatively, I could use AJAX to check whether the user has Development Mode enabled, and if so, disable the call from the "Send an Email" page. But I can't find a way to check that either.
Finally, I could use AJAX to check whether the user is an Admin, and if so, disable the functionality on the "Send an Email" page. This is not ideal, as not all Admins will have Development Mode enabled.
I'd appreciate hearing your thoughts on any of these approaches.