How Can I : Open a external link in cphBody

Jan 22, 2010 at 5:40 PM

On a page I want to setup a link to an external site but open this link within the current page . So I think I want to create an Iframe in cphBody and direct the link to open in that . So for example my page (that gets loaded into cphBody) may look like this.


Click here to the latest info.


and the result should be


Click here to the latest info

Here is the info


Any ideas how to do this ?

Thanks

Scott

Jan 22, 2010 at 6:21 PM
Edited Jan 22, 2010 at 6:22 PM

BTW if I do this on a normal apsx page using Iframe within cphBody it works fine, but if I try and paste the Iframe code into the page (in HTML view) it does not save it

Coordinator
Jan 22, 2010 at 9:32 PM
Edited Jan 22, 2010 at 9:37 PM

Untested, but I think something like this would work.

<a href="#" onclick="document.getElementById('iFrame1').style.display='';return false;">Click here to the latest info.</a>
<iframe id="iFrame1" src="http://www.google.com/" frameborder="0" style="width:300px;height:300px;display:none;"></iframe>

Note:  Edited code above because of mistake.

Feb 26, 2010 at 9:12 AM

Ben, I am still trying to figure out how I can do this. The problem is using the TinyMCE editior when I switch into HTML view and paste the IFRAME code in, it will not save it as I guess it does not understnad how to render it. So is there any way I can paste the HTML for IFRAME into a page file (i.e the XML file) and get blogengine to render it ?

Hope this makes sense

 

Feb 26, 2010 at 3:28 PM

Scott,

I'm not sure if this will help you or not, but I have found that the editor that comes with BE.NET often changes the markup that I write myself.

I would try using something like Live Writer, and publish directly from Live Writer to your blog. I'm not saying that this will fix your problem, but I've been much more successful with Live Writer when it comes to inserting my own HTML into a post.

Coordinator
Feb 26, 2010 at 5:44 PM

You can make iframes work with the default tinyMCE WYSIWYG editor.  To do this, in the admin folder is a file named tinyMCE.ascx.  In there are some initialization options for the tinyMCE.  You can tell it to allow iframes by adding the "extended_valid_elements" property, as shown below.  There's already a number of existing options.  You can add this one anywhere (such as the end).  Just make sure you add a comma to the end of the option preceding this new option.

tinyMCE.init({
    ..... existing options ....
    extended_valid_elements : "iframe[*]"
});

Feb 28, 2010 at 5:16 PM

Fantastic.. this opens up huge possbilites thanks a lot.

Scott