/    Sign up×
Community /Pin to ProfileBookmark

Cross-domain request

Hi!

I have written a script that generates advertisement boxes and I want to give someone piece of code to paste into his or her website. First thing I thought of was AJAX, but all I got was an error about not having privileges for request. That would be very nice if someone can tell me how to handle this error or other way to show results of php script on somebody’s other server.

Thanks in advance ?

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@Angry_Black_ManAug 18.2007 — you can try something like this:

http://www.hashemian.com/tools/visitor-IP.htm

users point to a javascript include that really points to a PHP file that just outputs information that would otherwise be used in a JS included file. (confused? just look at the source of the "js.php" file above)

anyway, now they link to a JS file on your site, but it pre-runs PHP first before dishing out JS formatted code.
Copy linkTweet thisAlerts:
@DokAug 18.2007 — ...but all I got was an error about not having privileges for request.[/QUOTE]This is called "same-origin policy". A script loaded from domain A can only interact with other scripts from domain A or send XMLHttp requests to domain A.
Copy linkTweet thisAlerts:
@malarzauthorAug 18.2007 — [B]aaron.martinas[/B] - thanks for that, I'll for sure think about it

[B]Dok[/B] - I've read about it, thank You too. Out of curiosity - is there any way to handle it ?
Copy linkTweet thisAlerts:
@DokAug 18.2007 — is there any way to handle it ?[/QUOTE]No. It's a security feature controlled by the browser.
Copy linkTweet thisAlerts:
@malarzauthorAug 19.2007 — [B]Dok[/B] - not so long ago I was searching for copying text to clipboard with js (now I know what I wanted so don't care). Then I found something about setting privileges. Is it my memory's fault or is there such a thing ?
Copy linkTweet thisAlerts:
@DokAug 19.2007 — Is it my memory's fault or is there such a thing ?[/QUOTE]Well...its called hacking (or cracking)...its generally against the law in most civilized countries ?
Copy linkTweet thisAlerts:
@malarzauthorAug 19.2007 — Oh... I didn't think about it in that way ?

Thank You both for Your time and help ?
×

Success!

Help @malarz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...