Can't use localhost as src of iframe

3,383 views
Skip to first unread message

Oussama He

unread,
Jul 14, 2018, 5:21:23 AM7/14/18
to Chromium-Extensions-Announce

I'm developing a chrome extension and I want to display in the popup (when a user click extension icon) a page that has an url of localhost, in this page I will check if a user is logged in my site and depend on status I will display content in the page.
So I tried these:

First:

  • create a popup.html (that doesn't contain the iframe)
  • in popup.js create an iframe and give it an srcwidthheight. than append it to the body.

Second:

  • in the popup.html add the iframe with the src of localhost.
  • in popup.js create an iframe and give it an src, width, height. than append it to the body.

Neither the first nor the second works. and I get this: 




But when I use a normal site in src, like http://bing.com it works and show the page of bing.com

PhistucK

unread,
Jul 14, 2018, 8:02:35 AM7/14/18
to oussa...@gmail.com, Chromium-extensions
And when you go to localhost in a regular tab, does it behave differently?

PhistucK


--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/6d29e994-54de-4515-a97a-6cac702e9517%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.

Francois Devatine

unread,
Jul 14, 2018, 10:47:26 AM7/14/18
to Chromium-Extensions-Announce
What do you write as path for your localhost page?
it should be file:/// something right?

Oussama He

unread,
Jul 14, 2018, 1:01:06 PM7/14/18
to Chromium-Extensions-Announce, oussa...@gmail.com
I see my page that has the content I would to display.


On Saturday, July 14, 2018 at 1:02:35 PM UTC+1, PhistucK wrote:
And when you go to localhost in a regular tab, does it behave differently?

PhistucK


On Sat, Jul 14, 2018 at 12:21 PM Oussama He <oussa...@gmail.com> wrote:

I'm developing a chrome extension and I want to display in the popup (when a user click extension icon) a page that has an url of localhost, in this page I will check if a user is logged in my site and depend on status I will display content in the page.
So I tried these:

First:

  • create a popup.html (that doesn't contain the iframe)
  • in popup.js create an iframe and give it an srcwidthheight. than append it to the body.

Second:

  • in the popup.html add the iframe with the src of localhost.
  • in popup.js create an iframe and give it an src, width, height. than append it to the body.

Neither the first nor the second works. and I get this: 




But when I use a normal site in src, like http://bing.com it works and show the page of bing.com

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.

Oussama He

unread,
Jul 14, 2018, 1:03:53 PM7/14/18
to Chromium-Extensions-Announce
No, the address of my is this: http://localhost:8888/portal/publications/. Is served by local server. (I'm using Django framework)

Francois Devatine

unread,
Jul 14, 2018, 10:35:50 PM7/14/18
to Chromium-Extensions-Announce
What does the console say? there must be an error?

PhistucK

unread,
Jul 15, 2018, 6:36:31 AM7/15/18
to fran...@gmail.com, Chromium-extensions
There might not be an error, it might be a redirect of some sort. Does the Network tab of the Developer Tools show anything of interest (a redirect, a request to localhost at all)?



PhistucK


On Sun, Jul 15, 2018 at 5:35 AM Francois Devatine <fran...@gmail.com> wrote:
What does the console say? there must be an error?

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
Reply all
Reply to author
Forward
0 new messages