Hello i have a php page which contains html content (head and body) along with js files in head I want to make its external java page so that users can embed my whole page any where into their website or a page the code should be looks like this, i have tried my level best but I am fail into this issue please help me <script type="text/javascript" src="mypage.php"></script>
If users want to embed your whole page in their website, why don't they use the <iframe></iframe> tags? <html> <head> </head> <body> <iframe src="http://www.YourPage.com"></iframe> </body> </html> HTML:
The above should work, just make sure the following is true: 1) The mypage.php file does not contain any <script></script> tags, just the raw Javascript code. 2) It doesn't hurt to add to the top of your script the following headers: <?php header("Content-type: application/x-javascript"); ?> alert('Testing JS Code'); PHP: