Files
omnivore/pkg/extension/src/scripts/content/grab-iframe-content.js
2022-02-11 09:24:33 -08:00

23 lines
495 B
JavaScript

/* global browserApi, ACTIONS */
'use strict';
(function () {
/* only run in iframe */
if (window === window.top) return;
const allowedURLs = /instagram\.com/ig;
const currentUrl = window.location.href;
const allowCurrentUrl = allowedURLs.test(currentUrl);
if (!allowCurrentUrl) return;
browserApi.runtime.sendMessage({
forwardToTab: true,
action: ACTIONS.AddIframeContent,
payload: {
url: currentUrl,
content: document.body.innerHTML
}
});
})();