Skip to content

Instantly share code, notes, and snippets.

@mbuckbee
Created May 16, 2011 09:19
Show Gist options
  • Save mbuckbee/974134 to your computer and use it in GitHub Desktop.
Save mbuckbee/974134 to your computer and use it in GitHub Desktop.
Dynamic iframe
function sendChatterMessage(sfdc_base_url, message_text){
$jquery('<iframe />', {
name: 'chatterFrame',
id: 'chatterFrame',
width: '800px',
height: '800px',
src: 'https://' + sfdc_base_url + '/_ui/core/chatter/ui/ChatterPage'
}).appendTo('body');
$jquery('#chatterFrame').load(function(){
// This line works
$jquery('#chatterFrame').contents().find('#publishereditablearea').val(message_text);
// This line (and multiple similar, document.getElementByID, etc.) do not work, though they work correctly from js console
window.frames["chatterFrame"].chatter.getPublisher().submit('', 'S');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment