Hi,

I am wondering if there is a way to create a link in an external site to the website using the insertiframe ad have it open the iframe to a particular page of the website inside the iframe?

i.e. If link 'A' one external site wants to go to the 'about page' of the iframe'd' website it would look like this [link__]
If link 'B' one external site wants to go to the 'products' of the iframe'd' website it would look like this [link__]

Appreciate any assistance...

CommentFileSizeAuthor
#10 Capture.JPG13.65 KBOnthegOinOz

Comments

OnthegOinOz’s picture

Title: how to create link to spcific website apge within iframe fron external site? » how to create link to spcific website page within iframe fron external site?
MarcElbichon’s picture

Title: how to create link to spcific website page within iframe fron external site? » how to create link to specific website page within iframe fron external site?

You can do this via jquery.
When clicking to you link ==> $("#myiframeid").attr("src", "url of the iframed page");

OnthegOinOz’s picture

Title: how to create link to specific website page within iframe fron external site? » how to create link to specific website page within iframe from external site?

Hi Marc,

please forgive my lack of knowledge bu I am not sure how to do what you suggest?

or example, in the external site I would usually have a link like <a href="url">Link text</a> ..... what should it be?

Also, if the external ste is in Drupal do I need to have the Jquery module enabled on both sites? does that have anything to do with your suggestion?

At least I know how to get the Iframe ID : )

thanks

MarcElbichon’s picture

Maybe i misunderstood your demand. Jquery can be use if link and iframe is on the same site.

You have a site A with a link to SITEB/link

In this page on site B, there's a frame where you want to point to.

I'am right ?

If yes :

In site A, call url http://siteb/node1?url=iframeurl

In your site B, on the node node1, select PHP filter (you may enable this module) and type :

     echo _insertFrame_getHTML($GET["url"]);
OnthegOinOz’s picture

It is in the exact situation that you just looked at on my site...

We just created a dedicated Iframe filter to display the Iframe (where it was conflicting with the WYSIYG). Right now I have the [[[http://www.myurl.com/myapp.html]]] in the body which calls the main page of the Iframe'd website. So in the circumstance that I have, should I also enable the php filter for the dedicated IFrame filter... and if so, then what would be typed into the body in addition to [[[http://www.myurl.com/myapp.html]]]?

Regarding the link, Site A (external Drupal site) has link http://siteb/node1?url=iframeurl... where I am assuming that the 'iframeurl' is the full url of the page I want to appear in the iframe i.e. http://siteb/node1?url=https://iframewebsite/thepageIwant

only a little bit more : )

MarcElbichon’s picture

So type in the body field (with php input format selected)

    echo _insertFrame_getHTML($GET["url"]);
OnthegOinOz’s picture

Ok... I did that with the link format I wrote and it returned "URL not set" on the page of site B.

If we can get that to work, onother point is that whilst I want to link to this site B and have it show a defined page on the iframe'd site, when a user just goes to the page on site B with the iframe, they should see the default page as set in the IFrame.

I am thinking that the solution you suggest does not allow for a default iframe page to exist?

OnthegOinOz’s picture

This is how the link ends up :
https://mysiteB/page/testphp?url=https://mysiteIframe'd/cart.php?a=add&pid=4
which returns "URL not set"

MarcElbichon’s picture

I 've look at your site and you must replace $GET by $_GET.
For default page, you can do :

   $url = "mydefaulturl";
   if (array_key_exists("url",$_GET)) {
      $url = $_GET["url"];
   }
   echo _insertFrame_getHTML($GET['url']);

OnthegOinOz’s picture

StatusFileSize
new13.65 KB

Hmmm. Unfortunately this does not seem to have worked?

Still the same result... snapshot attached

any ideas?

thanks

MarcElbichon’s picture

Can you resend me url of your site ?

MarcElbichon’s picture

Sorry for typo.

Code must be

$url = "mydefaulturl";
   if (array_key_exists("url",$_GET)) {
      $url = $_GET["url"];
   }
   echo _insertFrame_getHTML($url);

Modified to testphp.

MarcElbichon’s picture

Status: Active » Closed (works as designed)