943,547 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 4098
  • PHP RSS
Mar 2nd, 2009
0

How to call css file for iframe?

Expand Post »
I am calling some data from iframe.

php Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 3
Solved Threads: 15
Posting Whiz
Aamit is offline Offline
341 posts
since Apr 2008
Mar 2nd, 2009
0

Re: How to call css file for iframe?

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.
Reputation Points: 562
Solved Threads: 367
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009
Mar 2nd, 2009
0

Re: How to call css file for iframe?

here is what your opening html tag and head tags should look like.
PHP Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 5
Junior Poster
jakx12 is offline Offline
123 posts
since Jan 2009
Mar 2nd, 2009
0

Re: How to call css file for iframe?

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"
PHP Syntax (Toggle Plain Text)
  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??
Reputation Points: 3
Solved Threads: 15
Posting Whiz
Aamit is offline Offline
341 posts
since Apr 2008
Mar 2nd, 2009
0

Re: How to call css file for iframe?

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.
Reputation Points: 10
Solved Threads: 5
Junior Poster
jakx12 is offline Offline
123 posts
since Jan 2009
Mar 3rd, 2009
1

Re: How to call css file for iframe?

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:
PHP Syntax (Toggle Plain Text)
  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.
Reputation Points: 128
Solved Threads: 43
Posting Whiz
death_oclock is offline Offline
389 posts
since Apr 2006
Mar 4th, 2009
0

Re: How to call css file for iframe?

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:
PHP Syntax (Toggle Plain Text)
  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.
Reputation Points: 86
Solved Threads: 43
Posting Pro
NicAx64 is offline Offline
532 posts
since Mar 2009
Mar 4th, 2009
0

Re: How to call css file for iframe?

To quote myself for emphasis:
Quote 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.
Reputation Points: 128
Solved Threads: 43
Posting Whiz
death_oclock is offline Offline
389 posts
since Apr 2006
Mar 4th, 2009
0

Re: How to call css file for iframe?

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.
Reputation Points: 562
Solved Threads: 367
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Restarting Apps Using Php
Next Thread in PHP Forum Timeline: Sending file back to user





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC