I would like to embed an iphone/smartphone simulator in my website. I found this one:
https://github.com/rioleo/web-iphone-simulator
After adding the files to my directories, and trying to embed it:
<div align="center"><iframe src="http://localhost:8080/iphone?url=mysite" width="540" height="900" frameborder="0"></iframe></div>
A blank frame shows up with the message "The server refused the connection".
What causes the problem, and does anyone know other free simulators that can be embedded in websites?
Maybe dynamically modifying the navigator.userAgent string using JS? Take a look here.
Have you tried with iphone.php?url=mysite instead iphone?url=mysite??
Related
The solution is probably very simple, but still, I am struggling to understand how to make it work.
We are preparing for the new school year, and of course, we're required to make things work remotely. We will have a bunch of educational videos posted on Youtube, and an external Windows app will make sure everything is well organized and that teachers can easily upload new videos (via Youtube API), and that teachers can quickly share material to students.
And, when a teacher wants to send a video to students, he will obviously give them a link. They decided that they want videos to be played outside Youtube (for a number of reasons).
We have a WordPress website that is already functional, and which we can use to display Youtube videos that we can embed.
A WordPress page would have embed code for Youtube player, which is provided by Youtube.
But, the issue is that I don't understand how to make video ID changeable (b_DcQHbJIfE) so that one page can play any video which the Windows app sends.
Example:
External Windows app sends: https://www.externalvideoplayer.com/player/b_DcQHbJIfE
A website gets "b_DcQHbJIfE" and actually plays it on the embedded player
App then sends another video, like this: https://www.externalvideoplayer.com/player/c_gcOWSJISe
A website gets and plays "c_gcOWSJISe"
I know a little bit of PHP, and stumbled upon this code:
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
echo $actual_link;
But I am not sure if that would work when the page is loading, since the Windows app probably opens a URL that does not exist.
Any help would be greatly appreciated! Thanks!
I figured this out, here's the code:
<!DOCTYPE HTML>
<HTML>
<?php
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" :
"http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$url_ID = array_pop(explode('/', $actual_link));
?>
<iframe width="800" height="800" src="https://www.youtube.com/embed/<?php echo $url_ID?>" frameborder="0" gesture="media" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</html>
So now, when you load this PHP file, and if you add "/VIDEO ID" (https://www.example.com/test.php/c_gcOWSJISe)
The page will load any video that you enter into the URL. Note that this probably does not work on the localhost server, so you need actual server and domain to make this work.
Thanks!
I want to show doc file on a browser. I am using Google Docs API with iframe. But it shows me error that google docs refused to connect. I want to get rid of this error kindly help me out..
Here is my code in php, $file is a variable where I am getting the file name and I have to concat it with my iframe..
echo '<iframe src="http://docs.google.com/gview?url=http://192.168.0.56/orangehrm/admin/images/"'.$file.'&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>';
Based from this blogpost - Embedding a Google Doc:
Google provides an iFrame to embed your Google Docs. By default, WordPress will strip out iFrame code for security reasons. The iFrame code will disappear when switching between Visual and Text mode or when Publishing. To prevent this, you will need to change the provided iFrame code.
For example:
Try to change:
to:
I use iframe to view files from onedriver on my web app php.
it works fine before, but recently I can not, I have tried many ways but no result
This is code for my file php
<iframe src="https://onedrive.live.com/view.aspx?cid=ca91cd81c0fee9e6&resid=CA91CD81C0FEE9E6%21262&app=Word&authkey=%21AJHFjDm4aQXDEb4&wdo=1" frameborder="0" width="100%" height="100%"></iframe>
I was wrong place, everyone helps me!
On the document, right click and select: "embedded".
It will generate an iframe for you.
More information
I have a site on kiosk mode on chrome using iframe in which I am opening number of external sites. And each of the sites has their own links with target="_blank". I have no control on those external links.
I want to open all those external links inside iframe only or I would need to publish some message for those target=_blank links. I can't open new window on kiosk. I have searched so far and found it has to be some server side coding. Javascript won't be any help in that.
My iframe code:
navigateToExternal:function(href)
{
Engine.ui.openMenu();
Engine.ui.exit();
Engine.ui.mostRecentSection = "external";
$("a[data-navsection], a[href]").removeClass("disabled");
$("a[href='" + href + "']").addClass("disabled");
$(".footer").hide();
var sandbox = "sandbox=\"allow-forms allow-scripts allow-same-origin\"";
$("#content-container").append("<iframe id=\"contentFrame\" src=" + href + "\"" + sandbox + "></iframe>");
},
Any help or suggestion would be really great.
Thanks in advance!!
You can't, the parent page can't access the cross-site iframe and the iframe can't access the cross-site parent page.
This falls under the Same-Origin policy and can't be worked-around on the client-side. You could scrape those sites on the server and present them as your own, however I'm not sure how effective that will be.
If you're running on Chrome, you can try the html5 iframe sandbox attribute.
<iframe sandbox="allow-scripts allow-forms" src="..."></iframe>
More Reading
I get a work around on this and thought to share. We can pass a command line argument For Mac, open Terminal and run:
$ open -a Google\ Chrome --args --disable-web-security
and it will disable the Same-Origin-Policy and then we can make our required changes on cross site iframe.
I'm working with php to make some web pages and I'm having a bit of struggle with a link I'm trying to make.
Basically I have my <a> set with target="_self" on it so that it stays on the same page. (Note the page is a new window and that I also tried using "_top" and "_parent")
<img src="<?php echo $donnees[0]['id2_pathImgMini'] ?>" width="75" height="75" />
This is said link in its php form.
<img src="../images/propriete/DosAssorti/mini/L482_mini.jpg" width="75" height="75" />
This is the result arcoding to the browser when showing the source code.(Across IE,Firefox,Chrome)
<a target="_blank" href="http://ordi-003/inclusion/fiche.dos.assorti.info.php?id=14&lan=fr">
This is the same line according to Firebug AND the Chrome developping tools.
When clicking the linking the expected result is opening the link on the same page, however it opens it in a new window. Changing inside firebug "_blank" to "_self" and clicking the link afterwards gives the good results and opens the link on the same page.
Am I doing something wrong? Am I incorrectly using the <a> here?
Should I look for another way to make my link? I'm pretty open to anything really I tried different things and looked alot on google but couldn't find people with the same problem. Firefox cache is deactivated so that should not be the issue. Tried it on another computer too and it gives the same results.
If I gave too short information just tell me what I should also include as I am new to stack overflow.
Edit:I forgot to say that if I remove the target parameter and just put none, the "source code page" doesn't show anything like it should but in firefug and chrome dev tools it shows a target="_blank" still. Also just a note, there is only 1 copy of this file and it is on the localhost of the machine running the local site. I'm directly editing that file.
Edit2: http://pastebin.com/yrAMQEL9 be aware the indentation is awful on pastebin for some reason.
You're running different code than the code you're editing. Make sure your changes are making it to the server you're visiting in the browser and that you're editing the right file.
I finally found what was causing the replacement of my _self.
In the footer there was a script which was referenced and trough further research I found this bit of code
jQuery('a[href^=http]:not(.in)').attr({
'target' : '_blank'
});
It caused the replacement of the _self to a _blank.
Now that I know where the problem came from I just have to check with the original coder of that function why he needed it and if it is still needed.
Thanks all for your help.