Comments (3)
Redirection does not work in the function main/0, because wf:redirect uses wf:wire transmission for Actions in the browser. Thus because the page does not load; and does not load javascripts that are present In standard template and are responsible for the communication server and the client. Action #wire simply can not be executed in the browser because of lack of connection is initialized through n2o_bullet.
I suggest using the following scheme:
- Create template
empty.html
<html>
<head>
<script>{{script}}</script>
<script src='/static/nitrogen/bullet.js' type='text/javascript' charset='utf-8'></script>
<script src='/static/nitrogen/n2o.js' type='text/javascript' charset='utf-8'></script>
</head>
</html>
- And redirect as follows:
main() -> wf:redirect("/login"), #dtl{file = "empty"}.
It will be correct to redirect in the main/0 function.
Now the browser will receive HTML with links to the scripts (<script>...</script>
in <head>
section), download the javascripts. Loading scripts will create a connection through which will be transferred action #wire (window.location = '/login'
). Thereafter immediately be redirected.
Enjoy.
from n2o.
Thank you. It's works now. Before n2o.js and bullet.js developer need to add jQuery.js.
from n2o.
N2O version 1.4+ does not require jQuery and uses only native javascript.
from n2o.
Related Issues (20)
- Fire event on keypress/keydown HOT 4
- Apps couldn't be loaded: [kvs,mnesia] HOT 2
- question - Machine specs for the wrk benchmark? HOT 1
- n20 book link is broken on readme
- no function clause matching lists:flatten HOT 1
- no function clause matching lists:flatten HOT 5
- Change ws.send to wsn.send in all JS and NITRO renderers HOT 1
- bert.js int_to_bytes("true") causes node/v8 to crash
- bert.js decode error on the server: badarg HOT 1
- call to an undefined module ? HOT 1
- Автор наркоман HOT 1
- xhr.js has been deleted HOT 2
- Fails on basic setup HOT 1
- N2O to support latest Cowboy 2.x HOT 6
- Update n2o_mqtt to support EMQ X 3.x
- Adjust n2o_ring:send for IoT project
- Support TCP Connections
- n2o crash at startup: HOT 5
- from or form in record #cx ? HOT 4
- There is no samples folder inside n2o HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from n2o.