falsandtru / pjax-api

The advanced PJAX superior to SPA.
https://falsandtru.github.io/pjax-api/
Apache License 2.0
318 stars 28 forks source link

Not working on page with external Javascript #33

Closed nanook21 closed 6 years ago

nanook21 commented 6 years ago

I'm having a problem here: http://hostonfiber.com/pjax-api/gh-pages/demo/basic/1.html

If you click 2 it goes directly to a page with an embedded Tweet and does not load it using PJAX.

Any ideas?

falsandtru commented 6 years ago

You seem to have failed to load twitter widgets.

Failed to load https://platform.twitter.com/widgets.js: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://hostonfiber.com' is therefore not allowed access.

You have to load it using jsonp instead. jQuery is good for this workaround.

nanook21 commented 6 years ago

Thanks.

Do you know of a way to force all Ajax requests to be JSONP if CORS isn't set?

falsandtru commented 6 years ago

No. You have to dynamically load it yourself using any wrapper library.

falsandtru commented 6 years ago

I'll fix this issue with the next version. However, it supports async scripts only.

falsandtru commented 6 years ago

Fixed.