Java script acces denied.

Posted on 2009-06-27
Last Modified: 2012-06-27
Hello experts.
The final idea is to give my users the hability to place some content from my site on their. by providing the html (For example: "Put this survey in your site, just copy and paste this code in your page").

Every yhing is fine if the page where the code is placed is on the same domain, but i get acces denied when i place the code on a page in a diferent domain.

At the momento the code i would provide would be exactly as appears below, (Of course it is subject to change as the development advances).

The file script/ppublthirdparty.js works fine in other conditions (same domain)
the function PlspubSendDataGetContent takes three params.
1 a querystring, 2, The element to change, note "33" the same as the div id, 3 the page where the request should be made.
What it does is to send the query string in the first parameter (Post method) to the page in the third parameter, and then change the innerHTML indicated in the second parameter with the result returned from the post rquest. (Using the request object as described in any AJAX tutorial).
One thing I should mention is that some where in the function i try to get the window.location
I did not use iframe for the simple reason that I cant tell the survey height i developing time.
Note that the content contains more calls to the same jscript function.
Not using https.

Can anyone tell me how to succesfully provide content to third parties? Any solution please.

Thanks in advance.

<script type="text/javascript" src=""></script>

<div id="33">


<script type="text/javascript">

PlspubSendDataGetContent ('rq=gtsrv&srvid=000917828838604&wdth=280','33','');


Open in new window

Question by:Marsc

Accepted Solution

dlastlee earned 125 total points
ID: 24730058
There is no solution via Javascript for security reasons:
Although, I've heard that something may be in the works for IE and/or FF in the future.

I don't think there is a simple plug/play type solution for your client. The best solution I worked with is to provide a webservice on your end, then have the client produce a webservice or page with the same data, then have your script pull from that location. So in some sense, using their backend server as a proxy.
LVL 41

Assisted Solution

HonorGod earned 125 total points
ID: 24731220
You would need to have a server site application that would be allowed to connect to another domain, and use Ajax to make the request.

Server side applications don't have the same limitations/restrictions as do client side JavaScript.

Author Comment

ID: 24871320
Hi everyone. I am sorry for disapearing this time.
I really didn't find the solution on this.
I can't give a bloger a serverside script, thats not acceptable.
The implemented solution was finally the use of an iframe, and normal form post. That worked well, I would prefer an ajax solution, but it is not possible it seems.

I would delete this question if noone have objections.

LVL 41

Expert Comment

ID: 24871707

See the help:

Under "Asking questions"

Specifically: The correct answer to some questions is "You can't do that."

LVL 16

Expert Comment

by:CWS (haripriya)
ID: 37296663
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
Introduction HyperText Transfer Protocol ( or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now