Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

Change or set css in iframe link

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
doctor069
Asked:
doctor069
1 Solution
 
LZ1Commented:
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
 
doctor069Author Commented:
Yes I just want to change the link color. I am providing the content but on a different domain
0
 
Gurvinder Pal SinghCommented:
I don't think it is possible.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LZ1Commented:
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
 
level9wizardCommented:
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
 
doctor069Author Commented:
Sorry for the delay. Used a feed instead
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now