3

I have a simple php file having only:

<?php

header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("content-type:application/javascript");
echo "var md = 0 ";

In my html file I am calling the php file in iframe:

<iframe src="../API/index.php?i=MTQ4MDkyMDY1Mg==&d" width="100" height="100"></iframe>

While using the link in script tag its working but when I try to use it in iframe I'm getting the mime application/javascript error.

Tina
  • 71
  • 1
  • 7

2 Answers2

2

An Iframe can only accept html document.

You can do the js inside your html.

<iframe src="../API/index.php?i=MTQ4MDkyMDY1Mg==&d"></iframe>

and inside the php, remove all headers and do...

echo "<script type='text/javascript'>var md = 0; </script>";
Syed Waqas Bukhary
  • 5,130
  • 5
  • 47
  • 59
  • thanks for the comment but still the error is there m working on the same error the whole day – Tina Dec 28 '16 at 12:27
0

Found a solution for this error i.e the output is Javascript. What I need to do is create another file with and then use this file in the iframe. Just posted this answer if anyone else got the same error.

Tina
  • 71
  • 1
  • 7