routing - Embed external website in Rails template -
i have rails site , externally hosted wordpress blog. want able send users mysite.com/blog , have them hit blog. can pretty redirect. no longer on main site.
what want render blog inside main template, navbar site remains on page, , url stays mysite.com/blog. ideally, when clicked on link in blog, render inside template, navbar , url rails site remain intact.
is possible?
there few ways this. examples:
- iframes come mind first. frowned upon in modern web development, see this question lots of reasons, simplest way.
- jquery .load(), or basic ajax call. note because of same origin policy, won't work if you're trying retrieve domain. workaround include in wordpress site explicitly allow requests rails site:
<customheaders> <add name="access-control-allow-origin" value="http://your-rails-site.com" /> </customheaders> - html imports
there other ways including not limited <object> , <embed> tags. suggest research them , find best solution use case.
Comments
Post a Comment