The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.
Send messages to iframe using iframeEl.contentWindow.postMessage
Recieve messages using window.addEventListener('message')
| // http://css-tricks.com/multiple-simultaneous-ajax-requests-one-callback-jquery/?utm_source=javascriptweekly&utm_medium=email | |
| $.when( | |
| // Get the HTML | |
| $.get("/feature/", function(html) { | |
| globalStore.html = html; | |
| }), | |
| // Get the CSS | |
| $.get("/assets/feature.css", function(css) { |
| /* Pulled from https://github.com/joyent/node/blob/master/deps/uv/include/uv.h */ | |
| /* Expand this list if necessary. */ | |
| #define UV_ERRNO_MAP(XX) \ | |
| XX(E2BIG, "argument list too long") \ | |
| XX(EACCES, "permission denied") \ | |
| XX(EADDRINUSE, "address already in use") \ | |
| XX(EADDRNOTAVAIL, "address not available") \ | |
| XX(EAFNOSUPPORT, "address family not supported") \ | |
| XX(EAGAIN, "resource temporarily unavailable") \ | |
| XX(EAI_ADDRFAMILY, "address family not supported") \ |
| var errors = { | |
| // JSHint options | |
| E001: "Bad option: '{a}'.", | |
| E002: "Bad option value.", | |
| // JSHint input | |
| E003: "Expected a JSON value.", | |
| E004: "Input is neither a string nor an array of strings.", | |
| E005: "Input is empty.", | |
| E006: "Unexpected early end of program.", |
| SOPA Emergency IP list: | |
| Here’s how to access your favorite sites in the event of a DNS takedown | |
| tumblr.com 174.121.194.34 | |
| wikipedia.org 208.80.152.201 | |
| # News | |
| bbc.co.uk 212.58.241.131 | |
| aljazeera.com 198.78.201.252 |
| -- By Richard Kulesus, 2009. Released without license! | |
| -- Use this for whatever! | |
| -- I seriously despise code authors who copyright tiny bits of obvious code | |
| -- like it's some great treasure. This is small and simple, and if it saves | |
| -- the next guy some time and trouble coding applescript I'll feel good! | |
| -- | |
| -- Quickly change all the hot-corners to do what you want. | |
| -- Particularly useful for presentations and full-screen games. | |
| -- Customize the activity of each hot-corner with "all windows/application windows/dashboard/disable screen saver/none/notification center/show desktop/sleep display/start screen saver" | |
| -- The MODIFIERS are the keys which can be used to supplement hot-corner activation. |
| [ | |
| { | |
| "name": "Alberta", | |
| "abbreviation": "AB" | |
| }, | |
| { | |
| "name": "British Columbia", | |
| "abbreviation": "BC" | |
| }, | |
| { |
| //Add this at the bottom of your page right before </body> | |
| //Will let the page content load before loading js | |
| //Make sure you don't have critical js necessary for loading the page when using this because it will break it | |
| function downloadJSOnload() { | |
| var element = document.createElement('script'); | |
| element.setAttribute('src', 'a.js'); | |
| document.body.appendChild(element); | |
| } | |
| if (window.addEventListener) { | |
| window.addEventListener('load', downloadJSOnload, false); |
| javascript:(function() {"use strict"; var coupons = angular.element("#lt-coupon-area").scope().sharedValues.unfilteredItems.slice(); coupons.filter(function(x){return x.clipStatus==="U";}).forEach(function(item){ var c1 = document.cookie.match(new RegExp('swyConsumerlbcookie=([^;]+)'))[1]; var c2 = document.cookie.match(new RegExp('swyConsumerDirectoryPro=([^;]+)'))[1]; var data = {"items":[]}; var clip = {}; clip.clipType="C";clip.itemId=item.offerId;clip.itemType=item.offerPgm;clip.vndrBannerCd=""; var list = {}; list.clipType="L";list.itemId=item.offerId;list.itemType=item.offerPgm; data.items.push(clip);data.items.push(list); var request = new Request('https://nimbus.safeway.com/Clipping1/services/clip/items', { method: 'POST', mode: 'cors', redirect: 'error', headers: new Headers({ 'Content-Type': 'application/json', 'X-SWY_VERSION': '1.0', 'X-SWY_API_KEY': 'emjou', 'X-SWY_BANNER': 'safeway', 'SWY_ISREMEMBERED': 'false', 'X-swyConsumerlbcookie': c1, 'X-swyConsumerDirectoryPro': c2 }), body: JSON.stringif |