Issues with Save intent

47 views
Skip to first unread message

hse33

unread,
Aug 17, 2012, 9:24:28 PM8/17/12
to web-inten...@googlegroups.com
Hi,

I am trying to save an image file using the save intent. 

I am reading the file using the file-api into a blob, but when I try to activate the intent after passing this blob - I get a DOM Error 15 in Chrome (21) - the same issue happens if I try to pass it as a data url.

I have no issues with the pick intent - but this one seems to give me some real issues.

Any ideas?

My code basically gets a file system, gets a file entry, gets a file, gets a reader for this file, reads as dataurl - and sets the data url to the intent parameters object - I verified that the data url I get is correct (it displays just fie in an image DOM element)

{
                     'action': 'http://webintents.org/save',
                     'type': 'image/*',
                     'data' : theUrl
             };

Paul Kinlan

unread,
Aug 18, 2012, 2:21:07 AM8/18/12
to web-inten...@googlegroups.com

Hi,

How are you invoking the inter? It needs to be in response to a user gesture - if you don't you get this error.

P

--
You received this message because you are subscribed to the Google Groups "Web Intents discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/web-intents-discuss/-/b3miZYXR2UcJ.
To post to this group, send email to web-inten...@googlegroups.com.
To unsubscribe from this group, send email to web-intents-dis...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/web-intents-discuss?hl=en.

hse33

unread,
Aug 18, 2012, 10:12:43 AM8/18/12
to web-inten...@googlegroups.com
It is within a click handler (jquery) of an image (a button for all intents and purposes).

I tried to replace the access to the file-api to getting the data-url from the canvas instead - and I still get the same issue.

The code is within an extension - I do not know if this matters, the pick intent from within the extension works just fine.

Here is the example that gets the data-url, as it is shorter than the one that is dealing with the file-api.

Could the problem be related to the fact that I get the data via a callback? this might be related to your suggestion of having it start with a user-gesture.

$('.uploadImage').click(function(e) {

        var theUrl = this.parentNode.parentNode.getElementsByClassName('previewImg')[0].src; // get the source url of the preview-item


        getImageDataURL(theUrl, function(results){
            var params = {
                  'action': 'http://webintents.org/save', // share
                  'type': 'image/*',
                  'data' : results.data
            };
            var intent = new WebKitIntent(params);

            window.navigator.webkitStartActivity(intent, function(data) {
            });


R.

hse33

unread,
Aug 18, 2012, 10:30:58 AM8/18/12
to web-inten...@googlegroups.com
Update,

Removing the callback and doing it all inline seems to solve the issue. Thanks for the pointer.

BTW - is there a way to "suggest" a name for the file we send via the intent, maybe with a filename or title parameter for the save intent call?
Reply all
Reply to author
Forward
0 new messages