Solved

Change or set css in iframe link

Posted on 2011-09-19
6
240 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
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now