- Published on
Rapidly write and debug javascript in a page
- Authors
- Name
- Steve McNiven
- @stevemcniven
Sitefinity comes with a javascript widget, and so does my random site controls (a better one btw…).
The problem though is that if you’re writing inline script in the widget you need to keep editing and saving the widget, then previewing…it’s a lot of clicking and waiting. The other option is to maybe put the script inside a widget template, but then still you’re having to save it, and re-open for every little change…or use thunder. But then sometimes you hit save and the changes aren’t applied. This is an old error that exists with thunder that nobody wants to fix. I think it happens when you have a template open, build your site, then try to make a change and re-save the template.
The fastest way I’ve found is to link to a file in your dropbox that you can rapidly change (and use a real editor).
- In your dropbox, right-click your script, and click share
- In the SF Javascript widget on your page, go to the first tab and paste in the link to the file.
- **IMPORTANT** change the postfix from dl=0 to dl=1. This basically tells dropbox to serve the file, not the webpage that has a download link TO the file.
- Done…publish or preview, whatever works.
Now you can just save your .js file and reload your page to see the changes instantly (dropbox will sync faster than you can reload usually)