0

I'm building my first Chrome extension and I'm just trying to make it load a simple web page (ideally this web page would allow cookies. So, I'm thinking iframe is the best method)

For simplicity, let's say I wanted to load YouTube. Right now, I have a simple manifest.json that calls up my popup.html file. The code for the manifest is listed here:

{
  "manifest_version": 2,

  "name": "Getting started example",
  "description": "This extension shows a Google Image search result for the current page",
  "version": "1.0",

  "browser_action": {
    "default_icon": "icon.png",
    "default_popup": "popup.html"
  },
  "permissions": [
    "activeTab",
    "https://ajax.googleapis.com/"
  ]
}

Here is the contents of my popup.html file:

<!doctype html>
<!--
 This page is shown when the extension button is clicked, because the
 "browser_action" field in manifest.json contains the "default_popup" key with
 value "popup.html".
 -->
<html><head>
    <title>YouTube</title>
    <link rel="stylesheet" href="styles.css">
</head>

<body id="body" style="height: 526px;">
    <div id="toolbar" style="display: block;"><span id="options" class="icon"></span><span id="popup" class="icon"></span></div>
    <iframe id="youtube" partition="persist:messenger4" height="500px" width="400px" frameborder="0" src="http://www.youtube.com"></iframe>
</body></html>

The problem is that this just opens up a white page (fit to the width and height I specified, but doesn't actually load the web page.

Can anybody give me some input as to what I'm doing wrong?

JGoldz75
  • 47
  • 14
  • Please [edit] the question to be on-topic: include a [mcve] that duplicates the problem. For Chrome extensions or Firefox WebExtensions this almost always means including your *manifest.json* and some of the background, content, and/or popup scripts/HTML. Questions seeking debugging help ("why isn't this code working the way I want?") must include: (1) the desired behavior, (2) a specific problem or error and (3) the shortest code necessary to reproduce it *in the question itself*. Please also see: [What topics can I ask about here?](http://stackoverflow.com/help/on-topic), and [ask]. – Makyen Mar 04 '17 at 06:22
  • Chrome has [various appropriate consoles for your extension](http://stackoverflow.com/a/38920982/3773011). You should be aware of all of them. There will be a message in the console for the popup which will tell you what the problem is. I've moved your HTML into a snippet. You can run the snippet and look in the console for this page and see the problem too. Basically, choosing YouTube made things more complicated. – Makyen Mar 04 '17 at 06:29
  • Possible duplicate of [Getting around X-Frame-Options DENY in a Chrome extension?](http://stackoverflow.com/questions/15532791/getting-around-x-frame-options-deny-in-a-chrome-extension) – Makyen Mar 04 '17 at 06:40

0 Answers0