Cross Domain iframe Resizing

<iframe>’s which display content from different domains have security measures in place to prevent all sorts of stuff. For example, you can’t have JavaScript access anything inside it. It can be very frustrating, for example, if you just want to …

Avatar of Chris Coyier
Chris Coyier on (Updated on )

#78: On Web Advertising

In this screencast I discuss online advertising. What it is, how it works, and why it isn’t evil (except when it is). I talk about my experiences, the different services out there and the ones I use. Advertising is a …

Avatar of Chris Coyier
Chris Coyier on (Updated on )

Resize Iframe to Fit Content (Same Domain Only)

Normally you set and width and height for iframes. If the content inside is bigger, scrollbars have to suffice. The script below attempts to fix that by dynamically resizing the iframe to fit the content it loads.

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js?ver=1.3.2'></script>
Avatar of Chris Coyier
Chris Coyier on (Updated on )

One Page Résumé Site

A friend of mine recently sent me her résumé to look over. I’m definitely not a professional job hunter but I think in these situations any extra set of eyes can help fine tune the final product. As it was, …

Avatar of Chris Coyier
Chris Coyier on (Updated on )

Seeing The Details

When a great musician hears a great song, what do they hear? I am not a great musician so I can only speculate. I would guess that they listen for the emotion behind the song. Great songs are great because …

Avatar of Chris Coyier
Chris Coyier on

CSS Only Image Preloading

One big reason to use image preloading is if you want to use an image for the background-image of an element on a mouseOver or :hover event. If you only apply that background-image in the CSS for the :hover state, …

Avatar of Chris Coyier
Chris Coyier on

Automatic IMDb / Netflix / Amazon Movie Links

In this article we'll look at a way to automatically create and insert links that link out to the popular movie-based sites (or sections) Netflix, Amazon, and IMBb. We'll use jQuery JavaScript for this, so that this happens on the fly using soley the name of the movie, reducing what would be a tedious chore of manually collecting all these links into just a few lines of code.
Avatar of Chris Coyier
Chris Coyier on (Updated on )

Multi-product Quantity-based Order Form

The point of this form is that users enter quantities for different products and the math is done automatically updating all the different totals: quantity total, subtotal, shipping total, and final total. Monetary formatting is kept intact with some helper functions. Foxycart is integrated to show how it might work in the "real" world.
Avatar of Chris Coyier
Chris Coyier on (Updated on )

Get URL and URL Parts in JavaScript

JavaScript can access the current URL in parts. For this URL:

https://css-tricks.com/example/index.html?s=flexbox
  • window.location.protocol = “http:”
  • window.location.host = “css-tricks.com”
  • window.location.pathname = “/example/index.html”
  • window.location.search = “?s=flexbox”

So to get the full URL path in JavaScript:

var newURL = window.location.protocol + "//" + 
Avatar of Chris Coyier
Chris Coyier on (Updated on )