Solved

Change or set css in iframe link

Posted on 2011-09-19
6
245 Views
Last Modified: 2012-05-12
Hi -

I have an iframe that provides a link that I display on my page.

The style does not match my other links on the page so i looks odd.

Is there a way to change the style of a link in jquery so the colors match the others

Thanks
0
Comment
Question by:doctor069
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 30

Expert Comment

by:LZ1
ID: 36561635
Are you looking to change the style of the content inside the iFrame? If you are, are you the one providing the content of the iFrame?
0
 

Author Comment

by:doctor069
ID: 36561733
Yes I just want to change the link color. I am providing the content but on a different domain
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36561777
I don't think it is possible.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 30

Expert Comment

by:LZ1
ID: 36561824
If you have full control of the content that you want to style, then all you'll have to do is add some CSS and you should be good.

However, if your calling the iFrame from a different domain and then trying to style it from the domain that was called, your going to have some major security issues to overcome. This is because cross-domain scripting is a huge security risk and is generally not allowed or possible. It "can" be done, but for a simple CSS change, I wouldn't recommend it.
0
 
LVL 11

Accepted Solution

by:
level9wizard earned 500 total points
ID: 36562209
As LZ1 said, for security reasons, it's not possible to use javascript across domains.

There's probably a much simpler, and more reliable solution - it seems strange using an iframe for only one link. Assuming the reason you're doing this because the link is dynamic / changes, I'd want to know:

- if it's possible to use a feed (i.e RSS) or other more direct syndication of this link/content

- as the others suggested, if you have the ability to modify the contained content in the iframe

- if you can't modify it yourself, to ask the host of that link to allow for URL params to adjust the style, i.e. your frame src might look like example.com&style=two

- if it's possible to scrape the page yourself, cache the link on your sever and load it from there

- ask the host of the link if they can make a static 301 URL that always points to that dynamic link. i.e. http://301link.example.com would fwd to http://something-random.example.com/9jd81/rd12/ff-11/
0
 

Author Closing Comment

by:doctor069
ID: 36959946
Sorry for the delay. Used a feed instead
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
Suggested Courses

632 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