Get Frame src URL in address bar - html

I'm working on making a mobile version of a website hosted on a GoDaddy Windows server. The way GoDaddy apparently handles a mobile subdomain is by having that webpage be inside a frame. For example:
<head>
</head>
<frameset rows="100%,*" border="0">
<frame src="myurl.com" frameborder="0" />
<frame frameborder="0" noresize />
</frameset>
<!-- pageok -->
<!-- 02 -->
<!-- -->
</html>
The problem is that any link I open in that page opens within the frame and the URL in the address bar never changes. So my question is how can I get the frame URL to show in the browser's address bar. As far as I know, GoDaddy doesn't give me access to the file with the above html in it to allow me to alter that. Each page has an initial php script ran to check if it needs to redirect to a mobile browser, so if there is a way to do this with PHP, I can easily implement it.
Thanks for any help you guys can offer.

You can accomplish this using JavaScript on your page:
top.location.href = document.location.href;
This effectively "breaks" out of the parent frame by setting the parent frame window location to the location of the current frame.
Of course, you'd want to have some sort of indicator that you just broke out of the frame as to prevent looping:
if (
(document.location.href.indexOf("#ibrokeout") == -1) &&
(top.location != location)
) {
// Break out of the frame
top.location.href = document.location.href + "#ibrokeout";
}
Hope this helps.

Related

html meta tags not inherited in frameset's parent

I'm trying to make a webpage responsive which, by itself, works, but namecheap (which redirects to hopto (no-ip.com)), embeds everything in a frameset:
<frameset rows="100%, *" frameborder="no" framespacing="0" border="0">
<frame src="http://kmouratidis.hopto.org:8081/" name="mainwindow" frameborder="no" framespacing="0" marginheight="0" marginwidth="0">
</frameset>
which in turn means that the inner meta tag for checking viewport doesn't affect the outer frame. I'm pretty sure this is the intended behavior, I just want a suggestion as to how to solve this.
Printscreen (sorry, can't get view page source and view frame source to work well together) of what the whole code looks like
You can't control the HTML generated by your domain masking service.
You can't manipulate the DOM of that document later.
So: Get real domain hosting instead of using a masking service.
No-ip.com will provide that service.

Mobile links in an Iframe and IOS

I was trying today to open a mobile link from one of my webapp that runs in an iframe (same domain).
It looks like these links aren't recognized by apple ?
https://plnkr.co/edit/9Rp87NcVi9Kr4MGDgIwL?p=preview
Body file
<html>
<body>
1-888-888-1212
<iframe src="iframe.html"></iframe>
</body>
</html>
iframe.html
<body>
1-877-877-2323
</body>
In the following plunkr i made a little example of that.
My Local computer can recognize those links, both, and so does my multiple android devices. Although when it comes to IOS, nothing to be done about it, it will only work for the link that is not in an Iframe.
Anybody had a simillar problem and or knows a solution to this issue ?
By using a script to select the parent document from the iframe, it should work. try this:
edit Adding "target="_parent" to the anchor is the solution for those viewing this answer.
Dated answer:
<iframe id="test" src="iframe.html"></iframe>
<script>
var iframe = document.getElementById("test");
var iDoc = iframe.contentDocument;
iDoc.write('<a target="_parent" href="tel://1-888-888-1212">1-888-888-1212</a>');
</script>

Auto refresh in Mac not working for some site

I got a code that refreshes the html page as per the seconds I desire. I am on an Mac and I use the TextEdit app to make the HTML file. This code works for www.apple.com but it does not work for say, https://www.bitcointalk.org or http://www.macrumors.com.
I am not sure why this is happening. All I am doing is replacing the apple URL with bitcointalk url. I know I can also do this refreshing via Safari extension, but I need this code to work.
Thanks a lot
The code I am using is:
<html>
<head>
<meta http-equiv="refresh" content="5">
</head>
<FRAMESET>
<FRAME src="http://www.apple.com/">;
</FRAMESET>
</html>
EDIT: What I am trying to do is, create this html and move it to my iPhone, so that I can do the web refresh through my phone. Right now there are only paid apps in the App store that lets you refresh a page automatically every few seconds/minute and they are not really that good.
As #esqew pointed out in their comment, the sites that aren't showing up forbid access via frames by setting the X-Frame-Options HTTP header to DENY or SAMEORIGIN.
See https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options

Loading whole web-page

I try to load a concrete web page with iframe:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<iframe id="frame" src="http://www.euronics.ee/" frameBorder="0" width="1000px" height="700px"></iframe>
</body>
</html>
Why it cannot load whole page. It loads only body? It loads another pages well if i try.
If you check that sites code, you will see:
<script type="text/javascript">
//This block of javascript checks if the current page is opened in a popup IFrame
//and if this is true - closes popup and reloads parent window.
//We use Popup template for popup windows and only this template is accepted for popups. A window with any other template will be closed immidiately.
//This also solves the problem with redirecting to parent after user has logged in via Login popup. After loggin in user is redirected back to My Account page
//which in turn uses Audio template thus immidiately gets closed and parent gets reloaded.
if (self != top) {
$("body").empty(); //also clears body to avoid showing page content while the page is closing
parent.location.reload();
}
</script>
And that's why it won't load the site in your iframe I guess.
Not everyone likes the idea of their site to be shown on other sites in iframes. I would say that they just want real visitors.
When I try it in jsfiddle, I get the following console error:
Blocked a frame with origin "http://www.euronics.ee" from accessing a frame with origin "http://fiddle.jshell.net". Protocols, domains, and ports must match.
Could it be that the site you're loading has https requests?

Not Sure Why Apache Server Automatically Put A Site In Frame

Is there a configuration somewhere in Apache server that causes all pages to be in a Frame? I can't seem to figure it out.
<html>
<head>
<title>Platform</title>
<meta name="keywords" content="Platform">
</head>
<frameset rows="100%,*" border="0">
<frame src="http://someURL" frameborder="0">
<frame frameborder="0" noresize="">
</frameset>
<!-- pageok -->
<!-- 01 -->
<!-- -->
</html>
It essentially takes the meta tag out and use it for parent page and have everything else in the content of the page in the Frame.
Please let me know if you have any idea. I can't reproduced it locally on my laptop so I figured there has to be some configuration that doesn't match, but I have no idea where to even start looking. The same configuration for reverse proxy is used.
Is there a configuration somewhere in Apache server that causes all pages to be in an iFrame?
Not that I've ever heard of.
This sort of framing is typical of sites that have bought a domain name and are using it via Masking instead of using proper DNS hosting.