Failure of window.location http:inside c9 IDE


#1

This code

<script>
window.location='http://www.chrisjj.com/';
</script>

works fine in its own HTML file at http:// in a browser, but in c9.io IDE it fails with:

Mixed Content: The page at ‘https://ide.c9.io/chrisjj/test’ was loaded over HTTPS, but requested an insecure resource ‘http://www.chrisjj.com/’. This request has been blocked; the content must be served over HTTPS.

I can see why this happens, but since it is rather a spanner in the works for launching an http:-only page, I ask: is there a remedy?


#2

Because c9.io is loaded over HTTPS, it does not allow any HTTP navigation or embedding. Unfortunately, if you want to use that functionality, use it in a new tab with HTTP or get HTTPS on your site using a service like Let’s Encrypt (or CloudFlare, which uses LE)


#3

Unfortunately, if you want to use that functionality, use it in a new tab with HTTP

How? When I click “Pop Out Into New Window”, get a window on https://preview.c9users.io/chrisjj/test/hello-world.html and change that https: to http: and hit Enter, it reverts to https:

get HTTPS on your site using a service like Let’s Encrypt (or CloudFlare, which uses LE)

Thanks, but that’s not possible for a target site that’s not mine.


#4

Can you try accessing it at http://project-name-chrisjj.c9users.io? That does not for HTTPS, so it sounds like that’s what you’re looking for.


#5

That causes this fail in the Preview pane:

linking to Why can’t I load my app with HTTP in the embedded preview?
“The preview pane uses an iframe to load pages and the browser prevents pages from loading via http (without an “s”).”

It makes sense for the IDE to use secure HTTP, but it doesn’t makes sense it to not be freely usable to develop and app that doesn’t.

Outside the IDE, http://test-chrisjj.c9users.io/hello-world.html succeeds as expected.


#6

but it doesn’t makes sense it to not be freely usable to develop and app that doesn’t.

browsers do not provide any way to load http iframe in https page, so there is nothing that cloud9 can do to allow http preview inside the ide. The only solution is to open preview in a new tab


#7

browsers do not provide any way to load http iframe in https page, so there is nothing that cloud9 can do to allow http preview inside the ide.

Thanks, but then I’ve got to wonder how the designer ever thought in-IDE was going to work properly.

The only solution is to open preview in a new tab

On which browser is that going to show the preview and source simultaneously? On Chrome and Firefox here, that doesn’t. It requires the user to switch between the two.


#8

Yes, again, this is a limitation of the browser, and there’s nothing to be done about it without risking security and preventing the other content from loading. There may be an extension or something to allow iframes like that, but I wouldn’t recommend it, and unfortunately you won’t be able to have them side by side without putting a window on one side of the screen, and the IDE on the other.


#9

OK, thanks.

It would be good to see a list of such coding restrictions imposed by the c9 IDE.


#10

In general, I find there are very few restrictions. Most, including the one you mentioned, are the fault of the platforms, like the browser, but Cloud9 does have some limitations. Besides the obvious such as limited disk space and processing power, there are others, like only 3 ports being available and SMTP ports being blocked, and requiring a credit card for signup, but those are for good reason. The only other really big one I can think of is the rule against hosting, as Cloud9 is for development only. If any other people have other limitations that they find, feel free to chime in, but I personally forgive Cloud9 for these decisions, because in the end their product meets and exceeds my needs 99% of the time.


#11

In general, I find there are very few restrictions.
Most, including the one you mentioned, are the fault of the platforms, like the browser

If the browser platform is inadequate, then the fault lies with Cloud9’s decision to use it.

But you say platforms plural. Does Cloud9 have a platform that doesn’t suffer these problems?

but Cloud9 does have some limitations. Besides the obvious such as limited disk space and processing power, there are others, like only 3 ports being available and SMTP ports being blocked

Thanks.


#12

I understand your questioning of why they would use it, but their application is optimized for Chrome (and does become buggy in others), due to its large market share, especially of developers, and this is a limitation built into Chrome. My wording was rather poor, yes, there are other platforms, I believe they are on GCE, which may have some other limitations as well.