How to call css file for iframe?

Reply

Join Date: Apr 2008
Posts: 293
Reputation: Aamit has a little shameless behaviour in the past 
Solved Threads: 11
Aamit Aamit is offline Offline
Posting Whiz in Training

How to call css file for iframe?

 
0
  #1
Mar 2nd, 2009
I am calling some data from iframe.

  1. <iframe id="pframe" width="'.$game['iframewidth'].'" height="'.($game['iframeheight'] + 20).'" src="'.$path.'" frameborder="0" scrolling="no" align="middle"></iframe>';
  2.  

i want to call my css for this frame ?

How to call css for iframe??
Last edited by peter_budo; Mar 8th, 2009 at 6:50 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,380
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 167
almostbob's Avatar
almostbob almostbob is online now Online
Nearly a Posting Virtuoso

Re: How to call css file for iframe?

 
0
  #2
Mar 2nd, 2009
the source for an iframe is a html file (xhtml php cgi asp etc)
you just put the css, or a call to the .css file in the <head> of the source file, the same as any other html file
Last edited by almostbob; Mar 2nd, 2009 at 11:21 am.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 103
Reputation: jakx12 is an unknown quantity at this point 
Solved Threads: 4
jakx12's Avatar
jakx12 jakx12 is offline Offline
Junior Poster

Re: How to call css file for iframe?

 
0
  #3
Mar 2nd, 2009
here is what your opening html tag and head tags should look like.
  1. <html>
  2. <head>
  3. <title>YOUR TITLE HERE<title>
  4. <link rel=stylesheet type=text/css href=YOURCSSFILE.css>
  5. </head>
Last edited by jakx12; Mar 2nd, 2009 at 3:52 pm.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 293
Reputation: Aamit has a little shameless behaviour in the past 
Solved Threads: 11
Aamit Aamit is offline Offline
Posting Whiz in Training

Re: How to call css file for iframe?

 
0
  #4
Mar 2nd, 2009
I am asking about ...
is it possible to change the css of iframe...??

suppose i am on www.abc.com and my file is test.php
iframe is defined in test.php
$path="www.xyz.com/ddd?id=123"
  1. <iframe id="pframe" width="'.$game['iframewidth'].'" height="'.($game['iframeheight'] + 20).'" src="'.$path.'" frameborder="0" scrolling="no" align="middle"></iframe>';
  2.  

that means in this iframe data of xyz.com ...
so is it possible to change css or design??
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 103
Reputation: jakx12 is an unknown quantity at this point 
Solved Threads: 4
jakx12's Avatar
jakx12 jakx12 is offline Offline
Junior Poster

Re: How to call css file for iframe?

 
0
  #5
Mar 2nd, 2009
no if it is from another site. Basically an iframe is a way of implementing html in a window inside the original window. What the iframe is acting as is basically like a browser window, except its implemented with in a html document. You cannot change the style or css of another site if the iframe is directly linked to that site. Just like you cannot change the style of daniweb inside your browser window.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 357
Reputation: death_oclock will become famous soon enough death_oclock will become famous soon enough 
Solved Threads: 37
death_oclock's Avatar
death_oclock death_oclock is offline Offline
Posting Whiz

Re: How to call css file for iframe?

 
1
  #6
Mar 3rd, 2009
Well since this is a PHP forum, i'll give you a PHP solution. You could pass the css file for the iframe to use in the url like so:
  1. <iframe id="pframe" width="'.$game['iframewidth'].'" height="'.($game['iframeheight'] + 20).'" src="'.$path.'?style='.$style.'" frameborder="0" scrolling="no" align="middle"></iframe>
where style is the css file. In the iframe page, get this value from the $_GET superglobal and (after some error checking/security checks!!!) print the reference to this external stylesheet.
Last edited by death_oclock; Mar 3rd, 2009 at 8:41 pm.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 316
Reputation: NicAx64 will become famous soon enough NicAx64 will become famous soon enough 
Solved Threads: 19
NicAx64's Avatar
NicAx64 NicAx64 is offline Offline
Posting Whiz

Re: How to call css file for iframe?

 
0
  #7
Mar 4th, 2009
Originally Posted by death_oclock View Post
Well since this is a PHP forum, i'll give you a PHP solution. You could pass the css file for the iframe to use in the url like so:
  1. <iframe id="pframe" width="'.$game['iframewidth'].'" height="'.($game['iframeheight'] + 20).'" src="'.$path.'?style='.$style.'" frameborder="0" scrolling="no" align="middle"></iframe>
where style is the css file. In the iframe page, get this value from the $_GET superglobal and (after some error checking/security checks!!!) print the reference to this external stylesheet.

This type of code may open you to a security problem , because you can direct this to a aribritary maclious CSS file.

Most often , there can be many possibilities for an XSS with other source complixities.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 357
Reputation: death_oclock will become famous soon enough death_oclock will become famous soon enough 
Solved Threads: 37
death_oclock's Avatar
death_oclock death_oclock is offline Offline
Posting Whiz

Re: How to call css file for iframe?

 
0
  #8
Mar 4th, 2009
To quote myself for emphasis:
Originally Posted by Death_oClock
(after some error checking/security checks!!!)
In the page inside the iframe, thoroughly check the css file requested. I would make sure it is one of a select number of specific filenames, rather than checking just the extension, etc.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,380
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 167
almostbob's Avatar
almostbob almostbob is online now Online
Nearly a Posting Virtuoso

Re: How to call css file for iframe?

 
0
  #9
Mar 4th, 2009
Originally Posted by death_oclock View Post
To quote myself for emphasis:

In the page inside the iframe, thoroughly check the css file requested. I would make sure it is one of a select number of specific filenames, rather than checking just the extension, etc.
Thank you Death,
I have clips now from one site working in another, like they belong, despite there being vastly different css.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC