Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - Using AJAX across domains | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 7747/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 10-16-05 03:56 AM Link | Quote
I found a tutorial on how to use AJAX in Javascript to grab the source of another page. It's pretty cool, but if I try to grab a page from another domain, it triggers a 'permission denied' error in Firefox... Why is it being denied, and how can I allow it?

[edit] Fixed link.


(edited by HyperHacker on 10-15-05 10:23 PM)
Gavin

Fuzzy
Rhinoceruses don't play games. They fucking charge your ass.
Level: 43

Posts: 755/799
EXP: 551711
For next: 13335

Since: 03-15-04
From: IL, USA

Since last post: 13 hours
Last activity: 13 hours
Posted on 10-16-05 05:10 AM Link | Quote
The easy answer is: "you can't". It's a security consideration. Look up Microsoft's "Cross-Frame Scripting and Security" to understand it's rules... I know I had the Mozilla equivilant page somewhere in my links, but I can't seem to find it at the moment..

Although there are numerous browser specific exploits (especially IE) that allow you to reassign document.domain and trick the site into allowing you access to a domain of your choosing. And besides that, there are other forms of trickery (I currently know of only one, but assume there to be more) that do not require domain spoofing to send out requests across domains.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 7748/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 10-16-05 06:32 AM Link | Quote
Well using exploits is great and all, but they get fixed. (Stfu Xk. ) I only want to use this on a local file, so is it possible to configure Firefox to allow cross-domain requests for this (or all, if need be) page?

Also is it possible to send specific POST/cookie data with the request? I want to retrieve pages from sites that require logging in (some using https, some not). The idea being to parse them and make one big page out of them. [edit: found POST, dunno about cookies, but they probably won't be needed.]


(edited by HyperHacker on 10-15-05 09:32 PM)
(edited by HyperHacker on 10-15-05 09:33 PM)
(edited by HyperHacker on 10-15-05 10:44 PM)
Gavin

Fuzzy
Rhinoceruses don't play games. They fucking charge your ass.
Level: 43

Posts: 757/799
EXP: 551711
For next: 13335

Since: 03-15-04
From: IL, USA

Since last post: 13 hours
Last activity: 13 hours
Posted on 10-16-05 07:56 AM Link | Quote
No, Yes, and Yes. Let me explain:

No: Not all exploits get fixed, especially not with IE.

Yes: In this blog entry, a programmer describes his method for doing what it seems you want to do. Read the entire post. He talks about Mozilla's method for doing what you want, but why he thinks it's more of a hassle and why he chose the process that he did.

Personally, I wouldn't bother doing any of those things. I would just create my own Firefox Extension (which runs with advanced priveleges by default) for the sole purpose of whatever it is you are trying to accomplish. That's (probably, I haven't tried the method or read that article yet) the only reason that the Greasemonkey (another Firefox extension) method works: because it's an extension with advanced default priveleges. It seems all too indirect of a plan of attack, especially considering how easy it is to make extensions..

Yes: You can send anything you want via POST or GET just as you would with anything else. I don't know about HTTPS as I've never read or personally tried anything with it, so I can't offer any advice on that.

So in summation: Just create your own Firefox extension if you can. In my opinion you're setting yourself up to not get caught in potential restrictions with Greasemonkey (assuming, I've never tried it), and you may end up having to learn about extension/mozilla platform architecture anyway. Not to mention the fact that you can distribute your project to others if it turns out to be neat and you wish it so. But firstly, I suggest reading that article, as it might be faster for you if you don't already know the platform...
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 7752/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 10-16-05 08:31 AM Link | Quote
Actually, I won't have to make an extension (though I might ). According to that document I need only change a configuration setting and have the script request the ability to load other pages, and it will prompt me to allow it.

[edit] As for cookies, it seems that it just sends whatever cookie the requested page has set. So I only need to have logged into the site in Firefox before. Except for those sites that don't support cookies.


(edited by HyperHacker on 10-15-05 11:52 PM)
(edited by HyperHacker on 10-15-05 11:53 PM)
neotransotaku

Baby Mario
戻れたら、
誰も気が付く
Level: 87

Posts: 3964/4016
EXP: 6220548
For next: 172226

Since: 03-15-04
From: Outside of Time/Space

Since last post: 11 hours
Last activity: 1 hour
Posted on 10-16-05 10:19 AM Link | Quote
I had this same problem. The work around was to use another file to retrieve the page for you. I was working with JSPs and I was able to have a Java Class that retrieved the contents of another page and display that page instead of being itself.

So...

File A -- has AJAX that retrieves the contents of File B
File B -- retrieves the page with libraries and uses the retrieval as the output of the page

When File A makes a call to File B, File B will be processed by the server and will return the HTML of the non-domain HTML.

I hope that makes sense.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 7755/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 10-16-05 11:05 AM Link | Quote
That could work, but this method seems to work better. No reason scripts shouldn't be able to do this, just so long as I get to make the final decision.

Now if only I could figure out why the XMLHTTP object refuses to make more than one request. It seems like the only way to get it to do anything after making one request is to let all scripts finish executing, delete the object, and create a new one. Even if I delete and recreate it within the same function (or one called by it) the readyState and status just stay at 0 and nothing happens. And of course there's no way to actually wait for it to finish downloading, so the only way to even do multiple requests is to make one from the onReadyStateChange() of another.
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Programming - Using AJAX across domains | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.025 seconds.