I have done some digging out here and am still a little unsure how to accomplish this. Here is the scenario:
I have a full HTML site that calls the following PHP code:
<?php
require_once('inc/mobile_device_detect.php');
mobile_device_detect(true,true,true,true,true,true,true,'mobile/',false);
?>
<!DOCTYPE html>
<html lang="en">
<head>blah blah</head>
etc...
The mobile_device_detect.php is a small library from http://detectmobilebrowsers.mobi/
So when I go to the full site from my mobile phone, the redirect happens perfectly. Next, on the mobile/index.html I have the following redirect code for those users that are wanting to see the full site (I should also mention that this mobile site uses jquery-mobile):
<img src="images/icons/world.png" width="32" height="32" alt="Full Site" class="ui-li-icon">Full Site
When I click this link, I am resent back to the mobile page. I know this is happening because the redirect script is being fired again. I have tested this by visiting the mobile site with a desktop client and the redirect occurs perfectly.
Any ideas how I can remedy this for mobile users wanting to see the 'full site'?
You can append a query param on your href like href="../index.html?full=true" in your main page check that full param is not present.
<?php
if (!isset($_GET['full'])) {
require_once('inc/mobile_device_detect.php');
mobile_device_detect(true,true,true,true,true,true,true,'mobile/',false);
}
?>
Related
I was writing a long .php website and thought about embedding kiwiirc. The issue is, I keep getting an empty frame. The problem is even worse when I figured out that iframe for kiwiirc.com itself works, but not for the full embed code (example for not working: https://kiwiirc.com/client/irc.kiwiirc.com/?&theme=basic#your_channel ). Other sites work as expected too, the only issue I appear to have with is their own embed links. If I open their link in a browser, it works. I'm trying to run it on localhost.
Example of code not working:
<!DOCTYPE html>
<html>
<head>
<title>TEST</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<iframe src="https://kiwiirc.com/client/irc.kiwiirc.com/?&theme=basic#your_channel" style="border:0; width:100%; height:450px;"></iframe>
</body>
</html>
Kiwiirc's embed links: https://kiwiirc.com/embedding
If you run a Kiwi applet in a frame or iframe you have to enable third party cookies because the browser sees two different domains. Your domain and the domain where the cookies come from (your embedded applet)
Just a heads up, nothing wrong with the code. I installed chromium and tested it, and it worked. Usually using firefox with a lot of addons, odd thing being that all other embeds worked, and so this specific url when opened in a new tab.
I know it's not much of an answer, but it's browser's fault.
i'm novice in php and already searched the forum for this and found something similar although i don't understand it
i have 2 external links http://www.hello.com and http://www.bye.com
on click on each link, i want to load an intermediate page (eg: redirect.php) for 5 second with a
message: "You are leaving misite.com. goodbye."
and then, make the correct to the correct external link that applies in each case.
i need:
1.- content of redirect.php
Continue to external link
Continue to external link
i'm sure it's wrong.
also, i don't know how to put a 5 seconds spinner (gif) an then make the redirection (step3)
2.- link users click on it. is it ok?
i have:
hello
not sure if it's correct
the link the users hit, tries to call the link in the redirect page, but i'm unable
well, the thing i don't know how to make it work and i really aprecciate an example
thanks
You should make your link to redirect.php, and add the "final destination" as a URL parameter, as you have already done. On redirect.php, use a meta tag in the head section that redirects (see here for an example).
EDIT: Code requested...
In your main php page, have your links as you already wrote:
Hello
Goodbye
In redirect.php, you need to add a meta tag in the <head>...</head> section of your HTML:
<html>
<head>
...
<meta http-equiv="refresh" content="5;url=<?php echo $_GET['link'];?>" />
...
</head>
<body>
<h1>You are leaving my site!</h1>
<img src="/images/spinner.gif" alt="spinner" />
</body>
</html>
and that's it. The meta tag "content" attribute contains the number of seconds before redirecting, and the address to redirect to.
Hope this helps.
I have a Facebook Login Button on a login.php page on my website, and when its there it works like it should. But for some reason when I have a click on a link to this login.php the button doesn't appear. When I refresh the page, the button pops up. When I manually go to login.php the button appears every time.
This seems to only happen in Firefox (mac), I can't replicate the issue in Chrome. Firebug gives me this error, but it shows up even when the button loads:
document.getElementById("fb-root") is null
My Button rendering code looks like this:
<fb:login-button onclick="trainer()" perms="read_stream,email,publish_stream,offline_access,user_checkins,friends_checkins"></fb:login-button>
<div id="fb-root"> </div>
I have the FB.init code inside a script tag AFTER the body tag.
UPDATE: I've actually just confirmed that the same error pops up in IE8 on Windows.
Any advice could help thank you!
You might review a post by Gil Goldshlager to see if you have everything set up correctly.
One thing he points out is that you have to have your html tag set up correctly as follows:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en">
I am working on site in the php. In this site i have 10 screen shot images with herf tag. When a user click on any image, there should open a new tab with that site but actually showing the url of my site. Eg : if my site is www.abc.com From this site user will redirected to www.xyz.com. But the url above should www.abc.com. It will shows all the functionality of xyz.com site. If anybody knows, plz help me. I have seen that type of functionality somewhere before.
You could do that with a full iFrame, however that's really not the thing you want to do unless absolutely necessary.
The iFrame solution is very simple and maybe the best one for your problem.
But just to provide another possibility: You could implement a sort of web proxy with the PHP function file_get_contents. If you do something like that, you eventually have to deal with streams to preserve the context (COOKIES, etc.).
Finally you will have your own URL (maybe rewritten, to look nice), where the content of the other website is shown (but without correct ajax calls and maybe other issues).
You could use an iframe... or maybe .htaccess file will do what you need..?
If I get you right you want to change the browser's adressbar content? You can't do that.
I've found this on stackoverflow:
Modify the URL without reloading the page
Use full screen iframe:
<html>
<head>
<title>full screen iframe</title>
<style type="text/css">
/* Full Screen The Page Fix*/
body { margin: 0; }
</style>
</head>
<body>
<iframe src=".../site.html" style="border: 0; width: 100%; height: 100%">Your browser doesn't support iFrames.</iframe>
</body>
</html>
I have a
my_text
link on my page, and the following line in my_redirect_page.php:
header("Location: ".$mylink);
but after the redirection, if I click on back in my browser, the "my_text" for the link does not appear as visited (in purple, instead of blue). How do I work around this? Is there a way to change the visited property in php or javascript?
Thanks,
Dave
Not a terrific solution, but, in my_redirect_page.php:
<html>
<head>
<title>Redirecting...</title>
<meta http-equiv="refresh" content="0; url=<?php echo $_GET['link']; ?>">
</head>
<body>
Redirecting to <?php echo html_entities( $_GET['link'] ); ?>.<br>
If you are not redirected, click here.
</body>
</html>
Or something like that - the Page should load (thereby entering into the browser history) and then, with a delay of 0, load the targeted URL. Should, for some reason, the redirect fail, the user will see a page containing a link to the targeted URL.
I'm not sure this is possible, unless you change the way your redirects are done.
[This question][1] is basically a duplicate of yours, and the consensus was that none of the browsers allow you to set pseudo-classes (like :visited).
The easiest way to simulate it for the user is to set a CSS class which colours the link to look the same as a browser default or CSS-style visited link, which you can easily do in your view layer or by adding the class using javascript if the link appears in window.history.
You may also be able to push elements onto the window.history array, and have them appear in the browser history (and hence be given the :visited pseudoclass), but I'm not sure if that would work. Worth a try though.