popup+ajax+redirect

135 views
Skip to first unread message

Alexey Romanenko

unread,
Jan 23, 2011, 6:54:40 AM1/23/11
to Chromium-extensions
Hello all!

I have problem with sending ajax on page with redirect

my popup.html:

http://pastebin.com/yH2JfCWq

after loading popup.html I send ajax (url is http://www.etk.ru/etc_send_sms)
request and result save in first textarea

after click on "click!!!" I send ajax (url is http://www.etk.ru/scripts/sms_send_new.cgi)
with data.
the page http://www.etk.ru/scripts/sms_send_new.cgi has redirect but
$.ajax('') is not redirecting automatically.

if I run popup in new tab (not in extension) in console I look
redirecting but I get error about cross-origin access

Question: XMLHttpRequest in Chrome Extensions has limit on
redirecting? May be has page written about this?

Thanks,
Aleksey Romanenko

PhistucK

unread,
Jan 23, 2011, 7:57:23 AM1/23/11
to Alexey Romanenko, Chromium-extensions
If you get an error about a cross origin access, I guess it means you should add the domain to which the request is redirect to the permission list within the manifest.

PhistucK




--
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.


Alexey Romanenko

unread,
Jan 23, 2011, 8:03:35 AM1/23/11
to Chromium-extensions
Cross-origin error I get if I open popup.html on new tab, not in
chrome extension.

in manifest permissions is "http://*/*"

Any ideas?

On Jan 23, 6:57 pm, PhistucK <phist...@gmail.com> wrote:
> If you get an error about a cross origin access, I guess it means you should
> add the domain to which the request is redirect to the permission list
> within the manifest.
>
> ☆*PhistucK*
> On Sun, Jan 23, 2011 at 13:54, Alexey Romanenko <slimu...@gmail.com> wrote:
> > Hello all!
>
> > I have problem with sending ajax on page with redirect
>
> > my popup.html:
>
> >http://pastebin.com/yH2JfCWq
>
> > after loading popup.html I send ajax (url is
> >http://www.etk.ru/etc_send_sms)
> > request and result save in first textarea
>
> > after click on "click!!!" I send ajax (url is
> >http://www.etk.ru/scripts/sms_send_new.cgi)
> > with data.
> > the pagehttp://www.etk.ru/scripts/sms_send_new.cgihas redirect but
> > $.ajax('') is not redirecting automatically.
>
> > if I run popup in new tab (not in extension) in console I look
> > redirecting but I get error about cross-origin access
>
> > Question: XMLHttpRequest in Chrome Extensions has limit on
> > redirecting? May be has page written about this?
>
> > Thanks,
> > Aleksey Romanenko
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Chromium-extensions" group.
> > To post to this group, send email to chromium-extensi...@chromium.org.
> > To unsubscribe from this group, send email to
> > chromium-extensions+unsubscr...@chromium.org<chromium-extensions%2Bunsubscr...@chromium.org>
> > .

PhistucK

unread,
Jan 23, 2011, 8:08:51 AM1/23/11
to Alexey Romanenko, Chromium-extensions
Permissions should only include hosts, not paths (/*).
Try "http://*/", "https://*/" - maybe the redirection goes through HTTPS.

PhistucK



To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.

Alexey Romanenko

unread,
Jan 23, 2011, 8:44:50 AM1/23/11
to Chromium-extensions
Same result.

On Jan 23, 7:08 pm, PhistucK <phist...@gmail.com> wrote:
> Permissions should only include hosts, not paths (/*).
> Try "http://*/", "https://*/" - maybe the redirection goes through HTTPS.
>
> ☆*PhistucK*
>
> On Sun, Jan 23, 2011 at 15:03, Alexey Romanenko <slimu...@gmail.com> wrote:
> > Cross-origin error I get if I open popup.html on new tab, not in
> > chrome extension.
>
> > in manifest permissions is "http://*/*"
>
> > Any ideas?
>
> > On Jan 23, 6:57 pm, PhistucK <phist...@gmail.com> wrote:
> > > If you get an error about a cross origin access, I guess it means you
> > should
> > > add the domain to which the request is redirect to the permission list
> > > within the manifest.
>
> > > ☆*PhistucK*
> > > On Sun, Jan 23, 2011 at 13:54, Alexey Romanenko <slimu...@gmail.com>
> > wrote:
> > > > Hello all!
>
> > > > I have problem with sending ajax on page with redirect
>
> > > > my popup.html:
>
> > > >http://pastebin.com/yH2JfCWq
>
> > > > after loading popup.html I send ajax (url is
> > > >http://www.etk.ru/etc_send_sms)
> > > > request and result save in first textarea
>
> > > > after click on "click!!!" I send ajax (url is
> > > >http://www.etk.ru/scripts/sms_send_new.cgi)
> > > > with data.
> > > > the pagehttp://www.etk.ru/scripts/sms_send_new.cgihasredirect but
> > > > $.ajax('') is not redirecting automatically.
>
> > > > if I run popup in new tab (not in extension) in console I look
> > > > redirecting but I get error about cross-origin access
>
> > > > Question: XMLHttpRequest in Chrome Extensions has limit on
> > > > redirecting? May be has page written about this?
>
> > > > Thanks,
> > > > Aleksey Romanenko
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Chromium-extensions" group.
> > > > To post to this group, send email to chromium-extensi...@chromium.org.
> > > > To unsubscribe from this group, send email to
> > > > chromium-extensions+unsubscr...@chromium.org<chromium-extensions%2Bunsubscr...@chromium.org>
> > <chromium-extensions%2Bunsubscr...@chromium.org<chromium-extensions%252Bunsubscr...@chromium.org>

CqN

unread,
Jan 23, 2011, 3:25:08 PM1/23/11
to Chromium-extensions
Alexey,

Your pastebin link, when clicked, says expired. Perhpas some body
here will show you where to post with more persistence.

CqN

On Jan 23, 3:54 am, Alexey Romanenko <slimu...@gmail.com> wrote:
> Hello all!
>
> I have problem with sending ajax on page with redirect
>
> my popup.html:
>
> http://pastebin.com/yH2JfCWq
>
> after loading popup.html I send ajax (url ishttp://www.etk.ru/etc_send_sms)
> request and result save in first textarea
>
> after click on "click!!!" I send ajax (url ishttp://www.etk.ru/scripts/sms_send_new.cgi)
> with data.
> the pagehttp://www.etk.ru/scripts/sms_send_new.cgihas redirect but

Alexey Romanenko

unread,
Jan 26, 2011, 9:58:24 AM1/26/11
to Chromium-extensions
No problem:

<html>
<head>
<script src="jquery-1.4.4.min.js"></script>
<head>


<body>
<span id="aaa">click!!!1</span>
<textarea id="a1"></textarea>
<textarea id="a2"></textarea>
<script>

$(document).ready(function(){
$.ajax({
url: "http://www.etk.ru/etc_send_sms",
success: function(a,b,c) {
$('#a1').val(a);
}
});
});

$('#aaa').click(function(){
console.log("start");
var data =
"to=9011116483&message=x&send_date=&captcha_code=6cb04b5eaafb240167af83ec8727b94b&captcha_text=2874";
var url = "http://www.etk.ru/scripts/sms_send_new.cgi";
$.ajax({
url: url,
type: "POST",
data: data,
contentType: "application/x-www-form-urlencoded",
success: function(a, b, c){
console.log(a);
console.log(b);
console.log(c);
}
});
console.log("stop");
});
</script>
</body>
</html>

On Jan 24, 2:25 am, CqN <chackoner...@gmail.com> wrote:
> Alexey,
>
> Your pastebin link, when clicked, says expired.  Perhpas some body
> here will show you where to post with more persistence.
>
> CqN
>
> On Jan 23, 3:54 am, Alexey Romanenko <slimu...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hello all!
>
> > I have problem with sending ajax on page with redirect
>
> > my popup.html:
>
> >http://pastebin.com/yH2JfCWq
>
> > after loading popup.html I send ajax (url ishttp://www.etk.ru/etc_send_sms)
> > request and result save in first textarea
>
> > after click on "click!!!" I send ajax (url ishttp://www.etk.ru/scripts/sms_send_new.cgi)
> > with data.
> > the pagehttp://www.etk.ru/scripts/sms_send_new.cgihasredirect but
Reply all
Reply to author
Forward
0 new messages