Skip to content

Commit 593c40a

Browse files
committed
playground: Use https to access snippet store.
Snippet store now supports https. Loading resources over https is always okay, even on pages served via http (the other way around is a problem). References: - https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content - https://developers.google.com/web/fundamentals/security/prevent-mixed-content/what-is-mixed-content - https://stackoverflow.com/q/20516584 Helps #37.
1 parent c3e6134 commit 593c40a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

playground/playground.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type Line map[string]string
2323

2424
var output []Line
2525

26-
const snippetStoreHost = "snippets.gopherjs.org"
26+
const snippetStoreHost = "https://snippets.gopherjs.org"
2727

2828
func main() {
2929
var location = dom.GetWindow().Top().Location() // We might be inside an iframe, but want to use the location of topmost window.
@@ -36,7 +36,7 @@ func main() {
3636
if strings.HasPrefix(location.Hash, "#/") {
3737
id := location.Hash[2:]
3838

39-
req := xhr.NewRequest("GET", "http://"+snippetStoreHost+"/p/"+id)
39+
req := xhr.NewRequest("GET", snippetStoreHost+"/p/"+id)
4040
req.ResponseType = xhr.ArrayBuffer
4141
go func() {
4242
err := req.Send(nil)
@@ -230,7 +230,7 @@ func main() {
230230
})
231231

232232
scope.Set("share", func() {
233-
req := xhr.NewRequest("POST", "http://"+snippetStoreHost+"/share")
233+
req := xhr.NewRequest("POST", snippetStoreHost+"/share")
234234
req.ResponseType = xhr.ArrayBuffer
235235
go func() {
236236
err := req.Send([]byte(scope.Get("code").String())) // Send as binary.
@@ -266,7 +266,7 @@ func main() {
266266
if strings.HasPrefix(location.Hash, "#/") {
267267
id := location.Hash[2:]
268268

269-
req := xhr.NewRequest("GET", "http://"+snippetStoreHost+"/p/"+id)
269+
req := xhr.NewRequest("GET", snippetStoreHost+"/p/"+id)
270270
req.ResponseType = xhr.ArrayBuffer
271271
go func() {
272272
err := req.Send(nil)

playground/playground.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)