admin管理员组

文章数量:1416050

I'm trying to add a button to an app that uses Crafty, but, unlike the other buttons, I want this one to redirect the user to a different URL.

Notice that no-one ever taught me how to use Coffee or JavaScript, so I'm really new.

I'm trying to use the redirection here:

cfg.onClickTeacher = -> 
      preloadScene(CFG.ASSETS_MAIN, -> "www.my-site/teacher")

But it's not working, so, what do I have to do?

I'm trying to add a button to an app that uses Crafty, but, unlike the other buttons, I want this one to redirect the user to a different URL.

Notice that no-one ever taught me how to use Coffee or JavaScript, so I'm really new.

I'm trying to use the redirection here:

cfg.onClickTeacher = -> 
      preloadScene(CFG.ASSETS_MAIN, -> "www.my-site/teacher")

But it's not working, so, what do I have to do?

Share Improve this question edited Aug 14, 2013 at 15:47 Ry- 226k56 gold badges493 silver badges499 bronze badges asked Aug 14, 2013 at 15:44 SascuashSascuash 3,85111 gold badges49 silver badges67 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

That doesn’t involve Crafty, and is the same as in JavaScript.

cfg.onClickTeacher = ->
    window.location.href = 'http://example./'

(Relative URLs work too.)

本文标签: javascriptRedirect to URL from CoffeeScriptStack Overflow