0

I'm a beginner and need some help please.

I am trying to use an iframe to copy a schedule from another site. I need to remove the links from within the iframe. I have this so far:

<iframe src="www.example.php" width="750" frameborder="0" scrolling="no" style="min-height:400px; height:auto;" onload='javascript:resizeIframe(this);'></iframe>

What can I add to this to remove the links from the url?

Thanks so much in advance!

Glennyg
  • 1
  • 1

2 Answers2

0

If I understand your question correctly, you want to change the content inside the iFrame? Have a look at this question: jQuery changing contents of an iFrame

Community
  • 1
  • 1
Sjors
  • 1,205
  • 1
  • 8
  • 24
0

You cannot edit/update the content returned from iFrame untill it is on same domain. To access iFrame contents of different domain apply below solution.

This solution works same as iFrame. I have created a PHP script that can get all the contents from the other website, and most important part is you can easily apply your custom jQuery to that external content. Please refer to the following script that can get all the contents from the other website and then you can apply your cusom jQuery/JS as well. This content can be used anywhere, inside any element or any page.

<div id='myframe'>

  <?php 
   /* 
    Use below function to display final HTML inside this div
   */

   //Display Frame
   echo displayFrame(); 
  ?>

</div>

<?php

/* 
  Function to display frame from another domain 
*/

function displayFrame()
{
  $webUrl = 'http://[external-web-domain.com]/';

  //Get HTML from the URL
  $content = file_get_contents($webUrl);

  //Add custom JS to returned HTML content
  $customJS = "
  <script>

      /* Here I am writing a sample jQuery to hide the navigation menu
         You can write your own jQuery for this content
      */
    //Hide Navigation bar
    jQuery(\".navbar.navbar-default\").hide();

  </script>";

  //Append Custom JS with HTML
  $html = $content . $customJS;

  //Return customized HTML
  return $html;
}
Ahsan Horani
  • 239
  • 2
  • 13