I have two pages, one is index.html another is iframe.html
How to let the iframe.html only be loaded in index.html?
If iframe in other pages or directly type http://www.site.com/iframe.html in browser, the page only show some words like opps~~something is wrong.
something like bing shopping.
Thanks.
You could use the
window.parent.locationto fetch the parent url inside the iframe and act accordingly. If window.parent is not defined it probably means that the iframe.html was called directly. If it is defined inspect the value and ensure it comes from /index.html on your domain.