Chris Ng

Senior Staff Software Engineer at LinkedIn | Ember Learning Core Team | Speaker

Page 6


Inner iframe takeover it’s shell container

This is a way for the inner iframe to take on the full screen above the shell container of it’s parent.

By using CSS we can position it so that the iframe is on top of the parent, you might need to play around with z-index depending on your DOM model.

function makeIFrameFullScreen() {
    makeShellContainerRelative();
    $("iframe").css("position", "absolute");
    $("iframe").css("top", "0px");
}
function makeShellContainerRelative() { $("iframe").css("position", "relative"); }

View →


Downloading a file using JavaScript

This is a way to download a file by utilizing the DOM.

In this scenario, csv is a string variable with all the values to be in the table separated by commas. We specify the URI as csv and aptly name the file “myfile.csv”.

encodeURI is used on the variable csv to enforce escape sequence representation of UTF-8 encoding to the characters of the variable csv.

var uri = 'data:text/csv;charset=utf-8,' + encodeURI(csv);
var link = document.createElement("a");
$(link).hide();
link.href = uri;
link.download = "myfile.csv";
$("body").append(link);
link.click();
$("body").remove(link);

View →