0

As I saw this question is like duplicate but I have to ask you guys because I couldn't find any clear answer.

Let me explain my project,

I have an online store project that in this store we have two kind of products,

First group is our product that we added them to our website but the second group are products from other companies that they are our partnerships,

We want to show their website in our store as an Iframe or Popup,

Our customers searching that they needs on iframe and when they click on a button in our website we get the current iframe or popup current url and save it in our database.

I saw the solutions only works in the same domain but My domains are different,

I want to ask is it possible if not what you recommend me to do?

Amir
  • 41
  • 4
  • You're right, you'll likely run into [cross-domain issues](https://stackoverflow.com/questions/938180/get-current-url-from-iframe). You might need to coordinate with the other sites to find a solution. – showdev Sep 13 '18 at 20:09
  • A hopefully clear answer: you can't do it if the domains are different and the other domain doesn't want to change their site to let you in. If they are really partners, they should be willing to allow a cross-origin request from your site to theirs. – Heretic Monkey Sep 13 '18 at 20:09
  • Otherwise, I'm afraid this is a duplicate of [Getting iframe current src url in cross domain](https://stackoverflow.com/q/8766281)... – Heretic Monkey Sep 13 '18 at 20:10

1 Answers1

1

As I understood you can't get the Iframe current url because of security reasons, But I create href tag like popup and ask my customers to copy the link of popup and save it in my database like bellow,

<a href="@item.Link" class="text-default" onclick="window.open('@item.Link', 'newwindow', 'width=1000, height=1000'); return false;">Link</a>
Amir
  • 41
  • 4