Problem with file upload using chrome extension

1,223 views
Skip to first unread message

chunchulu govindarajulu

unread,
Jan 25, 2011, 6:55:35 AM1/25/11
to chromium-...@chromium.org
Hi,
  
   I am new to this chrome plugin extensions.

We  developed one number highleter function  through contentscript . We replaces the numbers in the entire page with our image. 

When user clicks on that image opens the jquery fancybox popup with multiple options.One of the option is upload the pdf file. We want to develop this logic through ajax. i.e. we want to upload the file without page redirect.

With page redirects its works fine.  For ajax we download jquery.form.js and upload the file with ajax request.

 But it creates an error says

"    Unsafe JavaScript attempt to access frame with URL https://mydomain/uploadfile.jsp from frame with URL chrome-extension://kjpgofemlblpfhcgaigepbjgpgbjccef/globalcall.html. Domains, protocols and ports must match.
"

Please sugguest on this.



--
Thanks & Regards,

C.Govindarajulu,
Ph.no : 9160862527.

Arne Roomann-Kurrik

unread,
Jan 25, 2011, 1:14:24 PM1/25/11
to chunchulu govindarajulu, chromium-...@chromium.org
You're trying to make a cross domain XMLHttpRequest which is forbidden by the browser.  Extensions can make cross domain requests, but not from content scripts - you'll need to send the request from a background page or another page in your extension.

You may want to consider opening an iframe to one of your extension's pages.  That page should be able to submit a form through Ajax (or even a regular form post, which would only redirect the iframe, not the main page).  If you go the Ajax route, make sure you have permission for "mydomain" in your manifest.

~Arne
  

--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.

Reply all
Reply to author
Forward
0 new messages