Not finding a way to embed website on magic mirror - raspberry-pi

How I can embed a website in my magic mirror display as I am really facing issues doing so or finding the right way to do it. The modules proposed on magicmirror.builders didn't work much for me. (iframe, etc.)

If you mean that your site cannot be embedded using iframe modules of MagicMirror, it's because some sites cannot be embedded by iframe.
There are several reasons, one of that is HTTP response header X-Frame-Options: DENY by the site makes iframe disable. This is needed for the internet security.
For MagicMirror usage, using WebView instead of iframe may resolve the problem.
I created the module.
https://github.com/Iketaki/MMM-WebView

Related

Accurate browser detection/redirect possible using JavaScript?

Please forgive me if this answer is somewhere else on this site or online. If it is, I sure haven't found it in the past several days of searching.
What I am hoping to find is an "accurate" method of detecting a browser and redirecting to a simple, static page if not a recent browser.
The samples I have found until now often have not provided an accurate representation of the actual browser being used. For instance:
When testing with Navigator 9, I'll get a message that I'm using Firefox 2
When testing with Maxthon 3, it reports I'm using IE 9.
My site displays correctly in all the current browsers I've been testing it with. But I wish I could have a basic static page for those .01% who still are using an old browser for whatever reason. They could still get some basic information from my site, as well as encouraged to update to a more current browser.
If anyone has any useful suggestions, I'd greatly appreciate them.
Thanks so much.
Cheers,
David
Browser detection is never perfect, for a variery of reasons. If you are using jQuery, you should look into jQuery.browser.
I'd try to detect the browser on the server side and do an HTTP redirect if the browser is something non-standard. Most decent frameworks have functionality to detect the browser from the user agent string. Again, this is not perfect, mainly because of the data browsers report. Also, if Maxthon reports it's IE, that's because it is based on IE and therefore the layout engine should be the same.
So you either
support a small number of browsers and cater for their quirks, sending all other browsers to a basic page (this sucks for future versions of browsers because they might be standards-compliant but they will still display your very basic page), or
you have a standards-compliant page for all browsers and then you define alternatives for the ones that give you problems.
I'd go for the second option. It usually all boils down to one version for all browsers, and a number of hacks for various versions of IE. Also, remember to avoid padding in your CSS and use margins instead.
In the end, you probably shouldn't be testing for browsers and version numbers, but supported features. Try using Modernizr.
The $.browser property is deprecated in jQuery 1.3. On jQuery support site, they strongly recommend to use the detection feature (JQuery.support) instead of the jQuery.browser property.
Actually, this has been answered already in another question, please check here How can you detect the version of a browser?

Embeddinig another website into a GWT application

I'm building a GWT application that looks great. At the end of the page I'd like to include a WordPress blog that I'm developing. In order to do that I want to use a com.google.gwt.user.client.ui.Frame so that an IFrame gets created, and the Wordpress just gets seamlessly embedded.
I've built this and it seems to work, although there's a problem with the size of the IFrame. I'm not sure how it's getting sized, but it's too small so that scrollbars are thrown onto it. This makes the the embedding not so seamless.
What should I be doing so that this second webiste can be seamlessly embedded into my GWT app?
The easiest solution is to make iframe as big as possible, and hope that there will be no unexpected scrollbars.
Also there is another way, if you have access to the innerDocument of iframe (if SOP doesn't stop you from doing this), you can compare its size against the size of iframe, and increase iframe height/width if necessary.
If blog is in another domain, you might try to use cross-document messaging to retrieve information about the size of document(this will not work in IE7,IE6 and you will have to put some additional JS on your blog).
Also you can include information from your blog without using iframes. You can simply pull RSS of your blog, parse it and display it in any way you like it.

Cross-domain navigation within Blogger without Javascript

The setup: I have a Blogger blog set up on a domain name as blog.mydomain.com. The main site site at mydomain.com is running Umbraco CMS.
The problem: I need to have the navigation from the CMS transported to Blogger somehow, so that making a change on the main website doesn't require the extra step of modifying the navigation inside Blogger.
Generating the navigation data on the CMS side in what ever format it needs to be (XML, unordered list, JSON, etc) is not a problem. The problem is getting the data from Umbraco to Blogger after it is generated.
I'm not yet willing to use Javascript, as this would seriously impair the website for users browsing without Javascript. (Too bad because AJAX would be a very workable solution.)
I've tossed around the idea of using an iFrame. How would this work for a navigation system including sub-menus? Creating and deleting multiple iframes is out of the picture, since I don't want to use Javascript. I could use one large iframe to allow for the sub-menus, but then it would cover content at the top of the content area, rendering it unclickable.
I'm thinking about how you could do this, but while I do - in this day-and-age javascript has become very common. Most users are going to have it, and those with it disabled really shouldn't be on the web. Is this the only reason you don't want to use javascript? Around 2% according to YDN have js disabled, and that's lower from other countries. As time goes on that 2% should get lower, I don't see that as an issue. However if you absolutely can't use javascript, I'll keep thinking. I might have an idea, I'll need to test it though.
It's not possible to use IFrame, cause of same origin policy. Both sites are on different domains, when user click menu item inside IFrame, there is no way to call parent window.
There are few ways how this can be done.
1) Javascript solution. Use json rpc, or another cross-domain calls. Load menu from your CMS and render it. Yes, this requires javsascript, but, seriously, show me the site, which does not use javascript.
2) Direct server communication.
Is it possible to perform http call from blogger ? If so, just perform http call to your CMS from Blogger, get data and render it.
3) Mixed flash/javascript solution. Flash can perform http call regardless of same origin policy. Get data with flash, use ExternalInterface to call Javascript function to render data.
There is no another way to do it. I suggest you to use javascript solution
You could build an HTML skeleton of empty ULs in Blogger (the max that you might need) to hold your navigation contents, and then link to an Umbraco-generated external stylesheet.
This stylesheet could fill those LIs with CSS generated content using the :before and :after pseudo-elements, and hiding unused LIs with CSS display: none.
An example of this is at: http://jsfiddle.net/5bXja/1/
This works in IE8+ so depending on your clients, this may-or-may-not be more widely supported than Javascript. Likely not. ;-)

Browser plugin for cross-domain iframe communication

I would like to create a browser plugin/extension that would allow the browser to read contents of a cross-domain iframe. I understand that this isn't possible with javascript, but perhaps someone could point me in the right direction of how to create a plugin that users could install. A cross-browser solution would be ideal.
Specifically, I am creating helpful navigation utility, and I want to know the url of the iframe so that I can prevent the iframe from navigating to any questionable sites accidentally. I would also like to detect the size of the contents.
Thanks in advance.
Option 1: file_get_contents:
What you can try is to get the contents from the page by the PHP function file_get_contents, load the CSS files and get the contents and the size of the page.
Option 2: Headers:
You can start here: http://www.senocular.com/pub/adobe/crossdomain/policyfiles.html
See the "allow-access-from" section where you can allow domains to be accessed cross domain when they have specific headers.
Userscripts have cross-domain XMLHttpRequest, and they will even run on all browsers. They (or at least Kango's Content Scripts) have the ability to write and read stored values for cross-window communication.

Facebook Like button breaks SSL because of the image-sprite loaded

We use the Facebook like button on the bottom of each page. We used to have the iFrame version but now changed to the FB version. On both solutions, we get an SSL error on our page because the image file is not loaded over a secure page.
When looking into the resources loaded, we see that two files are loaded securely:
https://www.facebook.com/plugins/like.php?app_id=110658975693059&href=http%3A%2F%2Fwww.stackoverflow.com&send=false&layout=button_count&width=280&show_faces=false&action=like&colorscheme=dark&font&height=21
https://s-static.ak.facebook.com/rsrc.php/v1/yK/r/PpEvPTmpg44.js
and the image sprite is loaded in plain http:
http://static.ak.fbcdn.net/rsrc.php/v1/z7/r/ql9vukDCc4R.png
I guess it is a temporary bug from facebook because the ssl-loaded css file references to a non-ssl image file. I created a bug report some time ago - with no response yet. Does any one have the same problem or even a solution on how to deal with that?
Thanks
There really is no fix for this that you can do on your end. Facebook must fix this, and they are extremely slow at fixing bugs. I noticed this on my site as well. Facebook's https css file is referencing non https images and causing this. I think this is a newer issue though because it used to work fine on my site.
We ended up grabbing the button resources and storing them locally. This improves page load time and solves any possible HTTPS issues.