简体   繁体   中英

How can I share a token variable from my main page to iframe other than using a post message?

I need to know how to share a variable in parent window to iframe.
My scenario is this,
I have 2 angular5 application say and .
B is loaded as an Iframe to A.
Authentication is done in A and I get an access token which i need to pass to B.
These are the things I tried.

  1. postMessage sent the token but as it is async event, B doesn't wait for it.
  2. Tried passing token as a header by making an AJAX get request with response type as blob but failed as only the index file is loaded not the angular chunks.

您可以将open B iframe与auth令牌一起用作查询参数:

<iframe src="yourURL?auth_token=ASDF1234"></iframe>

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