-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wf:redirect does not work. #61
Comments
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:
<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>
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 ( Enjoy. |
Thank you. It's works now. Before n2o.js and bullet.js developer need to add jQuery.js. |
N2O version 1.4+ does not require jQuery and uses only native javascript. |
Hi, it's me again. :-)
I saw in examples ( skyline ) next code:
main() ->
case wf:user() of undefined -> wf:redirect("/login"); _ -> [#dtl{file = wf:cache(mode), ext="dtl",bindings=[{title,<<"Account">>},{body,body()}]}] end.
In case of undefined It's not working. Why ? Cowboy returns empty page with next headers:
HTTP/1.1 200 OK
connection: keep-alive
server: Cowboy
date: Tue, 06 May 2014 19:07:55 GMT
content-length: 0
set-cookie: n2o-sid=1AKKkVnwL+qF4A4gSKYapA==; Version=1; Expires=Wed, 07-May-2014 19:07:55 GMT; Max-Age=86400; Path=/
But redirect works well when it called from event(X). WTF ?
Version HEAD.
The text was updated successfully, but these errors were encountered: