Wednesday, 7 June 2017

Inject script into crossdomain site

I have next task: User in our app configure some Html/JS/CSS widget, choose any site (google, facebook, etc...), clicks preview and he should see configured widget on this site (how? we need inject script tag with our widget to this site). How can I resolve it? Checked options:

  1. Use Iframe and inject script into iframe with google.com (doesn't work because of CrossOrigin policy)
  2. Use nodeJS proxy server (doesn't work for some sites, partially doesn't load images, scripts)
  3. Use phantomJS to generate new html and send it to the client (doesn't work because of relative path in src/href/url attributes for scripts/styles/images)

Does anyone have any ideas how implement it?



via Simcha

No comments:

Post a Comment