javascript - How do I redirect to different port on same host in Meteor? -


i integrating ghost blog runs on port 2368 meteor application runs on port 3000. ghost separate instance.

in below template file, hyperlink in meteor app pointing separate instance ghost blog.

<template name="header">     <header class="navbar">         <div class="navbar-inner">            <div class="top-nav">                 <div>                     <a href="{{pathfor 'home'}}">home</a> -                                              <a href="http://localhost:2368">blog</a> -                  </div>                                                    </div>         </div>     </header> </template> 

it works on local machine, meaning correctly redirects blogging system. didn't work when deployed production, still pointed localhost.

what best way detect host name regardless on local or production? there way make work through iron-router?

you can use meteor.absoluteurl([path], [options]) (http://docs.meteor.com/#meteor_absoluteurl).

for instance, html:

<a href="{{rooturl}}:2368">blog</a> 

and js:

template.header.rooturl = meteor.absoluteurl(""); 

Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -