I have one HTML files on one server and two files on different server, as below:
a.html - server 1
<html><head></head><body><iframe src="http://server2/b.html"></iframe></body></html>
b.html - server 2
<script type="text/javascript">/* <![CDATA[ */if (top == self || parent != top || document.location.hostname != document.domain) { top.location.replace("c.html");}/* ]]> */</script>
<!DOCTYPE html><html lang="en" id="myworld" class="no_js">
<head><meta charset="utf-8" />
<script type="text/javascript">/* <![CDATA[ */if (top == self || parent != top || document.location.hostname != document.domain) { top.location.replace("c.html");}/* ]]> */</script><noscript> <meta http-equiv="refresh" content="0; URL=b.html?st=1" /> </noscript>
</head><body>text is here</body></html>
c.html - server 2
<html><head></head><body>Please visit later.</body></html>
When I open http://server1/a.html
, I am redirected to http://website2/c.html
because it uses JavaScript and a meta tag for redirecting if the host is different.
What I want to do is: I don't want b.html
to run its JavaScript at all for redirecting and the meta tag refresh to c.html
.
How can code a.html
to render b.html
in my iframe only? So it should disable b.html
's javascript and meta tag.
It sounds like server 2 is a owned by a third-party and you have no control over it. Unfortunately the javascript you can see there is a 'frame breakout' script which is specifically designed to prevent the page from being embedded in a iframe, as you are trying to do.
One way around is to make an HTTP request directly from your web server to load page b
, and then strip out the javascript and include it as part of your page.
Edit: You should really ask the other site's permission, as you are basically redistributing their content if you do this.
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.