0

Hello I found this question about cross domain ajax request, which is close to my intention. As the other author I do not like a page-refresh to be done. Also I need to process the response later. One difference might be that I do include load a javascript from the other domain.

Preferably without an iframe, unless I can ensure the end-user does not see any differences.

My goal is to provide a javascript webservice, which is included (by random websites) with my delivered static (changeable) html, and javascript code. The javascript code does a request based on non-dynamic parameters and changes parts of the html code.

Maybe in past (I think to remember that some years ago it worked for me) it was possible to execute a post ajax-request if the script which does the post has been loaded from the domain the post is sent to.

Somehow this should be possible. Google Maps is a dynamic javascript application too?

One idea I also came up with is including a javascript (static or dynamically) which is generated by my server dynamically and not cached to avoid a dynamic post request.

How would you do that and which possibilities do I have beyond the answers of the above linked question?

Community
  • 1
  • 1
Jakob Alexander Eichler
  • 2,988
  • 3
  • 33
  • 49
  • js files can already come from anywhere, but you need CORS to use ajax to fetch an html file. or you can convert it to a javascript literal and use jsonp to fetch it if your server doesn't do cors. – dandavis Apr 07 '15 at 21:53
  • The solution I currently use, since a post-request is not possible (or I did not get it working), is an additionaly included javascript. The question was asked for the development of this widget and here you can see how it works: http://www.camnetwork.org/de/webcam_homepage_tool.html – Jakob Alexander Eichler Apr 08 '15 at 22:27
  • you can post a hidden form to any domain, but you can't get a response back unless the remote server supports CORS and you use ajax. images and scripts can come from anywhere, so the main core of google maps is just fetching the right urls of the image tiles to paint the scene. your dynamic app needs to update the html based on instructions from js, and those instructions can come from anywhere. enabling CORS on your server would provide the most flexible foundation because you can then grab even non-js files from any site. – dandavis Apr 08 '15 at 23:10
  • Maybe the way I did it helps to get arround it? If you extend my solution you can dynamically inject a – Jakob Alexander Eichler Apr 08 '15 at 23:19

0 Answers0