populating iframe with content from POST - php

I need to display content that was posted from the previous page within iframe. Is it possible?
The content will have HTML tags.
The reason why I need iframe, because it will also have reference to CSS. If I just echo it on page, then it will make problems with CSS style of the main webpage. The only sollution I have found is to use iframe.

Why not just correct your CSS?
FWIW, I don't think you are able to POST data to anything inside an iFrame, especially if you don't have control over the iFrame content.

Iframes link to a URL.
So if you can save the post data into a file on your server and then use ajax or refresh the page to inject the url to that file on the iframe, then you will be sorted.

Related

How to hide the href URL from users

I understand that it is possible to hide the url in the browser status bar by using javascript, but with this method, the url can be seen when the source is viewed from the browser.
how to hide URL from downloadlink?
We are using PHP Laravel.
I would like to know how to create a link button so that the user does not see the url. I am assuming that this might need to be implemented at the server (controller) side not a view side.
I would like to know the easiest way.
There are basically three different ways to hide links in HTML.
The first way is to use the tag without the href attribute. This hides the link from the HTML reader, but the link will still be clickable in the browser.
The second way is to use the tag with the href attribute, but place the entire link inside a span tag.
The third way is to place the entire link inside a span tag, and then you can use CSS to hide that span tag.
Whichever way you choose to hide the link, your link will still be clickable. When the link is clicked, it will still open in the browser window. Hiding links is very easy in HTML.

how can i Hide element of iframe in wordpress page template

I am displaying the iframe in wordpress page template. In iframe src i have pased the external site url. The Problem is that i am not able to to hide the logout link in the iframe.
I have tried the below mention code :-
frame = document.getElementById("toolkit-iframe");
frame.document.getElementById("top-nav-links").style.display='none';
OR
frame = document.getElementById("toolkit-iframe");
frame.contentDocument.getElementById("top-nav-links").style.display='none';
I have not got any success to hide the link of logout. Can anybody can help me. i will be verymuch thankfull.
There is no direct way to manipulate the content of an iframe, that's not hosted on your domain due to security issues.
However, there is a "hacky" workaround for your problem:
Place your iframe in a container div. Div gets relative positioning. Place another div in the container and set it to absolute positioning and perhaps a positive z-index. Set width and height and position of this hiding div according to the logoutlink size and position.
You can not inject javascript into a page from another domain, even within an iframe.

Load a div from external source

I am trying to load a div from another domain and display it on my site. An <iframe> will not work as the content is dynamically sized and I don't wish to render the entire page, just the content of <div id="content-article">
I have attempted to follow the guide from: http://frinity.blogspot.com/2008/06/load-remote-content-into-div-element.html however after reading the comments it appears to only work for external pages on the same domain.
I don't really care how it is done; php, jquery, ajax or what have you I just don't want to upload the same content to two different domains.
Is there any way to do this?
You can't when it should fetch it from external URL. Perhaps you can create a proxy or so and do a jquery.get?
You could use PHP's DomDocument to parse the HTML of the page that has the div and extract the div you want and then put it into your own content.
What is the URL with the div you want to grab? (Maybe we could write some code to help you pull it out.)

Get IFrame parent url or referrer using javascript or php

I am creating a widget that would load in a IFrame and users will be able to place the widget on their own website. How would I get the URL of the website that is using the IFrame in javascript and/or PHP? The IFrame loads a php file.
I have tried "parent.top.location.href" and "parent.document.referrer" in the IFrame page but that is undefined.
I have also tried to echo "$_Server[referrer]" in the IFrame page and that did return the IFrame parent URL, but how easy is it for someone to manipulate the referrer variable? I dont want to get misleading information.
I have also tried to echo "$_Server[referrer]" in the IFrame page and that did return the IFrame parent URL, but how easy is it for someone to manipulate the referrer variable? I dont want to get misleading information.
If this is a concern, give up. The referrer can always be trivially modified. It should never, ever be relied upon for anything important.

target a specific page in iframe

I'm running the CMS indexhibit, indexhibit uses an iframe to load it's content.
http://www.therussianfrostfarmers.com/
My homepage has WordPress loaded into this iframe, which works ok, i've got some scrollbar issues, but that another problem.
Currently, when ppl find a WP post through there search engine, the user is redirected to the homepage, i need to do this otherwise the user would only be able to view the WP content and not the rest of the site aswell.
e.g ;
http://www.therussianfrostfarmers.com/oldspeak/?p=480
What i need to do is to split the querystring, and send an 'id' into the iframe, which inturn would load the appropriate WP page inside the iframe.
I'm not sure where to start, Would i use PHP to split the querystring? and Javascript to target some iframe properties?
....any help would be much appreciated
thanks Cam
You might not have to split the query string. You could just use PHP to get the value of that GET variable, for instance:
$_GET["p"]
would equal 480 for the request http://www.therussianfrostfarmers.com/oldspeak/?p=480
then, you could just use the properties of the iFrame to change what it requests. I believe that the URL that the iFrame seeks is set in an HTML attribute. So you could just set the iframe URL to
http://www.yourwordpresssite.com/?p=<?php echo $_GET["p"]; ?>
Or a similar method.

Categories