Display web sites and web apps with Chromecast
One could imagine writing a Custom Receiver that has an iframe that wraps any website. Your sender would could then send webpages to your receiver, and the onLoad would set the the URL of the iframe. Don't have any code, but it's fairly simple to write.
I was able to modify the Github sample Project > googlecast/CastHelloText-chrome to show a web page.
- In the
receiver.html
file, I replaced theDIV
with anIFRAME
and styled it for 100% width and height. - Then in the
displayText()
function I changedinnerHTML
tosrc
. - The only modification made to the sender
chromehellotext.html
was to replaceYOUR_APPLICATION_ID
with the app id created by registering the receiver.
Note that some sites like Google and Yahoo will not display inside an iframe. If you really needed to do that you could skip the iframe and just set window.location.href
to the URL. That, of course, will overwrite your receiver code so the only way to change URLs would be to manually disconnect first and reload. I tried using window.open
instead but that did not work.
There is a simple way to do that with the hellotext sample. You can send the html by typing that into the text field.
<iframe src="http://mywebpage.com" style="width:1280px;height:720px"></iframe>