Twitch Embedded Clips Error - Refusing to connect - javascript

I am trying to embed twitch clips and videos on a site and it feels like I'm hitting my head against a wall here.
I have an articles division holding an embedded twitch clip. On both my ftp site and localhost, the embedded clip doesn't work.
I can only assume I am doing something wrong with my parent but I have tried almost everything.
I get this twitch connect error - I have followed the twitch API but not coming right.
Not sure if it makes a difference but the html file is located in the directory - abcstreamer.co.za/commingsoon/streamclips.html
This is my local hosted code:
<article class="stream stream-1 has-post-thumbnail">
<iframe
src="https://clips.twitch.tv/embed?clip=EphemeralPlainSaladPipeHype-24G9rCNWcx09Wc42&parent=localhost:5500"
allowfullscreen="true",
autoplay=false,
height="100%"
width="100%">
</iframe>
</article>
Below is my ftp site code:
<iframe
src="https://clips.twitch.tv/embed?clip=EphemeralPlainSaladPipeHype-24G9rCNWcx09Wc42&parent=abcstreamer.co.za"
allowfullscreen="true"
autoplay="false",
height="100%"
width="100%">
</iframe>
Could someone who has maybe worked with the twitch API call assist in correcting a mistake I cant seem to see.

abcstreamer.co.za doesn't exist so I can't debug for you
Twitch Embeds require the site to be over SSL.
And you may need multiple parent if your embed is in an iframe on your site. Site builder Tools such as wix will put the embed in and iframe on the site so you need two or more parent's declared.
So you might need
https://clips.twitch.tv/embed?clip=EphemeralPlainSaladPipeHype-24G9rCNWcx09Wc42&parent=abcstreamer.co.za&parent=www.abcstreamer.co.za
To account for www. if you don't redirect www. to non www. or vice versa. The same applies for redirecting non SSL users to the SSL version
or
https://clips.twitch.tv/embed?clip=EphemeralPlainSaladPipeHype-24G9rCNWcx09Wc42&parent=abcstreamer.co.za&parent=www.abcstreamer.co.za&parent=someotherdomain.com
If someotherdomain.com handles the iframe on the site builder if any
The "mega thread" has further advice on determining your parent stack https://discuss.dev.twitch.tv/t/the-great-big-im-using-wix-somewebsitemaking-tool-and-i-dont-know-how-to-fix-my-embed-thread/26297/

Related

Why is YouTube making requests to ourdomain.example.com/error_204

We have a WordPress blog running under via a reverse Proxy under ourdomain.example.com/blog which embeds YouTube videos.
Now we are seeing requests in the chrome network tab to
POST https://ourdomain.example.com/error_204?a=logerror&t=jserror&type=SyntaxError&msg=Failed%20to%20execute%20%27postMessage%27%20on%20%27Window%27%3A%20Invalid%20target%20origin%20%27data%3A%27%20in%20a%20call%20to%20%27postMessage%27.&line=Not%20available&level=WARNING&client.name=1
This requests lead to problems in our main software (Magento, under '/', showing CSRF problems)
We could just block those requests in the server but we want to understand why they are made.
Did anybody see those requests before?
The YouTube player is apparently attempting to send an internal error report to Google servers, via the endpoint http://youtube.com/error_204, http://youtube-nocookie.com/error_204 or similar. For that purpose, it uses the relative URI /error_204; but for some reason, this relative URI is resolved relative to your domain name, not YouTube’s.
What you should do is ensure that the link to the YouTube video points to YouTube’s domain, not your own. I presume that this is a problem with the configuration of the reverse proxy, but I am unable to say much more without further detail.
The error is originating from YouTube trying to access something on data: which isn't https, or potentially the video is not visible when loaded.
Just search for data: in your project, I don't know what you've got that would be using it.
The error message itself is fairly unhelpful.
The reason was a wrong embed code of the YouTube video
<iframe width="600" height="560" &" frameborder="0" allowfullscreen="" allow="autoplay" data-src="https://www.youtube.com/embed/xxxxx?
There was a wrong & sign, caused by some WordPress template builder

I need a way to get the content inside website urls. Many sites are not showing up in iframes due to cors issues

I have a URL and I need the content inside this URL. Actually, I wish to embed the content present inside this URL. What all are the possible ways to do this without any cors issues??
I have already tried using iframes and other tricks to avoid cors issues. But still, I am not able to embed many websites in an iframe. My main aim is not to embed a website in an iframe but to embed the content inside the website URL.
I will be more than happy if there is an API which returns me back the content in a URL website.
If there is not, then how can I create such an API?? And how do I get it hosted??
As a solution to this, I created a flask app which will return me the whole website so that I can embed it in my iframe. But then it is like a proxy server and I cannot host it on Heroku because Heroku does not allow public proxy server.
Please note embedded the whole site or just the content is of similar use to me. It is just that when embedding the site, it will be interactive and in the other case, it will not. I am good with both, embedding just the content or the whole website.
Now, I am thinking to make a web crawler which will crawl the web, cache websites and store them in a database. I am thinking to host this on firebase. I have no idea about the capabilities of the firebase. I just know that it provides us with a NoSQL database and some cloud functions.
The cloud functions part interests me.
I don't know if the following is correct/feasible.
I will send the URL(whose content I need) to firebase. It will then fetch the whole website and store it in the database(so, that next time I request the same URL, it does not need to recache the whole site again) and then return me this cached content.
If there is other better way to do this, please let me know.
I need the content for my chrome extension https://github.com/Shaikh-Ubaid/InSyd
For code, please refer to this GitHub repo.
To get an idea of why I want to get content/embed content, I am attaching a gif showing the working of the extension.
<img src="https://raw.githubusercontent.com/Shaikh-Ubaid/InSyd/master/Popup-demo.gif" alt="gif" />

HTTP iFrame blank in HTTPS page

Please help me!
I've installed SSL certificate on my server and now can't access on "mixed contents" anymore. My actual problem is an iFrame widget which is HTTP only:
<iframe src="http://www.exchangerates.org.uk/widget/ER-LRTICKER.php?w=435&s=1&mc=USD&mbg=FFFFFF&bs=no&bc=000044&f=verdana&fs=10px&fc=555555&lc=597384&lhc=FF8201&vc=FF8201&vcu=008000&vcd=FF0000&" width="435" height="30" frameborder="0" scrolling="no" marginwidth="0" marginheight="0"></iframe>
The result is that I get the content blocked (blank on page) on both Firefox and IE.
Is there any workaround? But please just don't tell me to change browser settings since my users are not going to do so.
Thanks in advance for your attention!
The easiest solution (for you) is to have the 3rd party supply a SSL/TLS URL.
If that however is not possible you are out of luck (with only frontend languages as tagged on your question).
If you are also running a backend language though you could proxy the iframe URL and provide the proxied URL in your iframe e.g. https://yourdomain.com/exchangerates which retrieves the page (including the resources used).
Another option would be to see whether the site has an API so you can download the data you need so that you can display the data on a page you control yourself.

Single Page App won't show up in iframe on a asp.net web app

I am trying to get a Single Page application to show up in an iframe on a separate asp.net web application.
I can get just about anything else to show up in that iframe except single page apps. This is all for testing purposes for a current web application being used so I have to do it this way.
This is the html:
<iframe name="frameMain" width="800" height="450" src="http://localhost:51219 ">
</iframe>
When I debug it I get a 403 forbidden error.
I figured it out. You need to specify the SPA's startup page in the src. I am still not sure as to why it wouldn't just go right to the startup page to begin with.

IE warning workaround? Page w/Secure and insecure items

I have a page that is viewed secured with 'https' in the URL, that also contains youtube urls to play video from youtube. Since the youtube URL contains 'http' with no 's' IE is giving an a warning dialog of "This page contains both secure and non-secure Items."
Is there a way I can workaround this in Javascript? Maybe after the page loads generate the youtube player HTML with a function? The url will still have to begin with 'http://'
EDIT: Thanks everyone for the input so far! I know this sounds impossible. I'd be happy if there was some conditional comment or something so I can tell IE to suppress this dialog box. It confuses our customer since most of the world is in IE, FF has much better behavior in that it tells you if you click the broken lock, but not an annoying popoup. This is like a new version of "your program has performed an illegal operation." (user hides from police) I am embedding youtube video onto the page where the src is from youtube. I am using their player, as it is hosted by them. No way out of this that I see.
I guess my fix is to only apply HTTPS to the very sensitive pages (password change, login) and come out of it in all others so youtube videos don't give this popup. I am in PHP and am worried the SESSION will get clobbered if I do this but I guess it is the only way around and will wait to tackle that bear monday.
One thing I've done to work around this problem is to create a page on my SSL site that proxies in the 3rd party resource. That way the client only sees SSL URLs.
For example, you flash player could point to the URL "https://YourSite.com/proxy.aspx?URL=http://www.youtube.com/video.swf". When "proxy.aspx" is called, it would make a new web request to the URL in the query string and return the data to the client.
If you do this you need to validate the proxied URL or use some kind ID so that the URL can not be changed since you are convincing the browser that this content is trusted.
I've worked around this problem on all browsers using the following:
1) Create a thumbnail image of the start of the video with the "Play image" tag on the snapshot and host the image on your own https server. Embed the thumbnail where you want the video to be.
2) When the user clicks on the image invoke a Javascript onclick handler to create a new window with the href of the http embedded youtube video.
function onImgClickHandler() {
//Link to embedded Viddler or Youtube video
var win = window.open("http://www.viddler.com/player/###/", "My Video",
'height=500,width=800,resizable=yes,scrollbars=yes');
win.focus();
}
3) The video will now appear in a popup of the main page.
I usually use videos as tutorials for my site, so having the video in a popup browser window works well because it can be viewed alongside the main content and lets the user follow along with the site. The browsers do not even give a redirect warning that you are invoking an http popup from an https site, so your users will not see any "scary" non-secure item warnings on any browsers.
Hope this helps, I have an example of the above on the landing page of my site: https://drchrono.com/
UPDATE: I made the image preview by taking a screenshot of the playing video.
According to this quite recent YouTube API blog post, embedded YouTube videos already support access via HTTPS. If this is the case, (and I haven't tested it, but equally I have no reason to not believe them), then you should just be able to stick the "s" into your embed URL and it will work just fine.
If there was a way around it would be a security flaw in IE and Microsoft would patch it, so I don't think you're going to get away with mixed content and no warning.
The only alternative is to host the FLVs yourself. There are a number of good SWF based FLV players available.
Having insecure links on a secure web page is an issue that has little workaround. One option is to exclude specific content on your page when a user connects via https. In this way a non-secure page load would display the content and a secure page load would not display the content:
<% if (!Request.IsSecureConnection){ %>
<div>You can't see this if the page is secure<div>
<%} %>
I have used this method with much success... Hope this helps.
I have had this same problem and found a solution.
It works without having to turn of SSL certification.
Step by step guide to fix Google chrome
You can view the fixed page listed below. It has links to YouTube,Flickr and many other websites. It is secure and has been for a few months now. Hope it helps you too.
The mod_rewrite module of the Apache httpd server can be used to embed YouTube videos on SSL secure pages without any errors, as detailed on Adam Mershon's blog.
It involves setting up a rewrite rule to redirect a path within the SSL domain to non-SSL YouTube:
.htaccess
RewriteEngine on
RewriteBase /
RewriteRule ^youtube/(.*)$ http://www.youtube.com/$1 [L]
So that inside your HTML you can embed YouTube link URLs appearing to be from your own domain, such as:
<embed src="https://www.yourdomain.com/youtube/v/mydjFYoD4WS&hl=en_US&fs=1&rel=0&autoplay=1&"
type="application/x-shockwave-flash"
allowscriptaccess="always"
allowfullscreen="true"
width="560"
height="340">
</embed>
Using Javascript to replace the URL does not work. IE7 intercepts the content, and thereafter, the warning.
I tried using (jQuery) $(function() { }); it sortof works. You can click yes/no to the dialog, the content will load nonetheless.
This is a severe problem in my world. It earns my work comments from users like "It's not user-friendly", "It's broken" or "It killed my kitten".
The proxy solution probably is the only pseudo-fix that's gonna roll. Just that it's clearly not a perfect solution either.
I try to navigate this a bit better by running as much of my sites on https as I can. Obviously the youtube case isn't fixed by that.
IE, what a silly hunk of FUD-pushing abominationware. I hope IE9 really is as vastly better as it seems. Just, not supporting XP means, well, it's sort of like it was never released. As the n00biest of users, will unwittingly write-protect the status quo until the XP-powered Chineese Skynet of 2247 finally feeds us the red pill...
Your problem occurs become the main page is grabbed using Https whilst one or more included files ( images, javascript, css etc ) is fetched using http. Fix the http url to be https.

Categories

Resources