Javascript Window Open not working

Hi guys,

I’m using self-hosted 2.0 version.

A few days ago I’ve made a button column and attached to a script that takes a url string and call window.open(url). It was working during my tests, but now I’m getting error: TypeError: Cannot read property ‘open’ of undefined
at Proxy.main , line: 27

Any idea what can it be? Now I’m trying to open a pre-filled form and use js to create the url and open the window.

Hi, welcome to the SeaTable Forum!

The JavaScript in SeaTable 2.0 runs inside of a sandbox, which doesn’t allow you to operate outside the sandbox. So the window.open() shouldn’t work at all. I’m surprised you got it working during your test! Did you test in SeaTable or somewhere else? And in which version did you test it?

Anyway, we’ll deploy SeaTable 2.1 soon, and will cancel the change we made to 2.0, so the script should work by then!

A related topic: Fetch not a function

I was using version 1.8 before the upgrade, problably it worked only in that version.

I’ve tested this feature but not using and now I tried to put it in production. In this case it is not a must have, but I’m sure it will help in many other situations.

tks

Hi, I am using SeaTable Cloud and also cannot get window.open(...) to work. Is that because the change was not cancelled in 2.1 after all, or is it because I am using the Cloud edition?

Hi, and welcome to the SeaTable Forum! The change was cancelled in 2.1, but it was problematic so we changed it back in 2.2…and SeaTable is on 2.5.6 now, which means it’s still not possible to use the window.open() in the JavaScript!

But since then we have done a lot with the Button feature, it allows you to do a lot of things like sending an email, opening a website in a new window, or executing a JavaScript. You might want to try that and see if it can offer you a work around!

Thanks for the very prompt reply! The option to open an URL might provide a good-enough workaround. The main reason I was looking into using window.open is because I wanted a way to automatically close the newly opened window again after processing (i.e. with window.close), but the workflow I had in mind doesn’t stand or fall with that.

Great! You are welcome to share your workflow for further discussion / suggestions (but perhaps in a separate post), as sometimes it could involve some automatons with Zapier, Integromat or n8n which could be a little tricky for beginners with SeaTable.