Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Change css for page in iframe

Posted on 2007-07-22
2
Medium Priority
?
1,916 Views
Last Modified: 2007-11-27
Hello,

I would like to change the style sheet for a third-party (remote) website I have inside of an IFRAME.

For example I would like to manipulate Google:

-- I want all images to have a red border around them
-- I want the color of all text links to be green

<html>
<head>
<title>Google in an IFRAME</title>
</head>
<body>
<iframe src="http://www.google.com" width="700" height="500" frameborder="0" scrolling="auto"></iframe>
</body>
</html>
0
Comment
Question by:hankknight
2 Comments
 
LVL 30

Accepted Solution

by:
third earned 1000 total points
ID: 19542907
can't be done for security reasons.
0
 
LVL 1

Assisted Solution

by:paulhamer
paulhamer earned 1000 total points
ID: 19548311
I've did something similair. As said before, it can not be done in Javascript due to securty reasons. If the page inside the iframe was one the same domain as the page which holds the iframe, only then would this be possible using Javascript.

So, I did it on the server side using a JSP

In the iframe I call a JSP file, which reads the HTML from the specified URL and simply outputs it. Fairly simple: Since this JSP is inside the same domain my Javascript is now allowed to access anything inside the iframe.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question