0

I have an Iframe embedded inside a website. Both are on different domains but both are owned by me. I am trying to pass a query param to iframe src.

<iframe
    id="iframe"
    title="Survey"
    allowtransparency="true"
    allowfullscreen="true"
    src=https://example.com/web-response/63760b884ec0a674d3cc5b04?isEmbedded=true
    frameborder="0"
    style="min-width: 100%; height: 100vh; border: none"
    >
    </iframe>

Notice the query param isEmbedded. But I am unable to access this query param in my child website(Next.js).

In my Next.js application I am using next router to access this param.

const {isEmbedded} = router.query

It is coming as undefined.

Is it possible to pass queary params cross-domain? If yes than what can be a possible way.

  • Does [How can I get (query string) parameters from the URL in Next.js?](https://stackoverflow.com/questions/43862600/how-can-i-get-query-string-parameters-from-the-url-in-next-js) help ? – Gabriele Petrioli Nov 22 '22 at 06:51
  • I am able to get the param value when running the application independently. but not when embedded inside an iframe. – Mohammad Ubaid Nov 22 '22 at 06:54
  • Comments in the https://stackoverflow.com/questions/63900509/chrome-ie-iframe-not-passing-query-string-parameter question suggest that it might be an issue with the `SameSite` cookie setting. – Gabriele Petrioli Nov 22 '22 at 07:40

1 Answers1

0

You can add the following into the iframe tag:

referrerpolicy="unsafe-url"

Zafer
  • 2,180
  • 16
  • 28