最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Redirect to URL from CoffeeScript - Stack Overflow

programmeradmin1浏览0评论

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.)

发布评论

评论列表(0)

  1. 暂无评论