Answer the question
In order to leave comments, you need to log in
Problem with Cross-Origin Read Blocking. How to include html file?
Greetings.
In general, we are talking about connecting a widget to a third-party site. The link is inserted like this:
<script src="http://test.meconnect.ru/widget/test123.js" async></script><a href="https://meconnect.ru" style="position:absolute; left:-9999px;" alt="" /></a>
switch($profile_account->template) {
case 'one' :
include_once 'profile_widget_one.php';
break;
}
header("Content-Type: text/javascript");
header("Content-Type: text/html")
Answer the question
In order to leave comments, you need to log in
The problem is that your php code returns html. You must return content type text/javascript
, and the file must contain js code that will already add your widget's html to the page.
Your content starts to be sent before the header is set
Put a line header("Content-Type: text/javascript");
before the uncommented code
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question