Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have an ASP.NET website in which I embedded an iframe inside a page and open a third party website inside it, i.e. I do not have a control on that website. Now that website uses a javascript with "window.top" at many places to access elements, like:
window.top.$('#elementid')...

The problem is as the website is opened in an iframe, "top" inside third party website refers to topmost browser window which is my website page, and not their website. So it will not get elements with id it uses. And so it throws javascript errors and not loaded correctly. When I open that website in new tab, it loads correctly.

Can you provide me the solution to make "top" refer to the iframe itself?

What I have tried:

Using "window.self" can resolve the problem, but I cannot modify javascript of third-party website. So I need some other solution. Also that website must be displayed inside my website page only.
Posted
Updated 2-Aug-17 0:55am

1 solution

Including 3rd party website has legal problems to, not only the fact, that they created a web page to be hosted directly in browsers window and not by anything else...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900