joshuef / beaker

A browser for the SAFE Network
Other
20 stars 7 forks source link

safe-js not available on localhost unless using the polyfill #16

Open happybeing opened 7 years ago

happybeing commented 7 years ago

Operation System: Linux Beaker Version: 0.4.0 (also 0.3.6-2)

I've been using the polyfill exclusively so have only just tried without and find that safe-js is not working on localhost unless you use the polyfill.

Fine on a live safe: URL though.

With localhost, not polyfill and websecurity disabled, a new tab loaded with my safe site and I poke around in the debug console I can only get this object and method:

window.safeAuth.getAuthToken()

No other safeAuth methods, no safeNFS or safeDNS objects! But with the polyfill they are all there and working.

It is not a problem as I can just use the polyfill until I deploy, but I think it is supposed to work without it as well, even on localhost.

joshuef commented 7 years ago

@theWebalyst safejs etc should only be loaded into the window object when on safe: urls, so this is expected behaviour.

What's curious here is that safeAuth.getAuthToken shows up...

joshuef commented 7 years ago

@theWebalyst are you still seeing this in newer versions? Can you let me know the url you're on when this is showing up, please.

happybeing commented 7 years ago

I was probably mistaken on safeAuth.getAuthToken() - it appears in the menu but I now realise that isn't necessarily because it is present on the object (it remembers past selections!).

So assume you're good here I suggest.