简体   繁体   中英

Outlook Web Add-in: how to redirect to other page?

I'm currently working on an outlook web add-in with login and some other pages. The flow would be a user should first log in and once they are successfully logged in the Add-in should redirect to a home page. So currently I'm using the window.location.href to redirect to a different page.

if (authenticated) {
      window.location.href = '/home/home.html';
}

However, when I'm in the home page and click a button that will redirect again to different page an error occurs. When I checked the console for the location it became https://localhost:44320/home/foo/foo.html instead of https://localhost:44320/foo/foo.html . I know I can just assigned the whole url but I want it to be shorter by just calling the page (foo/foo.html).

My question are what would be the proper/best approach on this and is there any different ways on doing this -- redirecting Add-in to different page?

You can use location.pathname = '/home/home.html' to solve it

or generate full url with

var fullUrl = location .protocol + "//" + location.host + "/home/home.html"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM