Embed a browser in a webpage using Ruby on Rails - ruby-on-rails

I'm working on a project where I need to embed a very simple browser in a webpage using Ruby on Rails.
For example, if a user is on my website, he/she can click on a link for a different website, it will open it inside a small window in the same original website.
Same idea of an embedded browser in mobile apps.
Is it possible to do?

You can try to use the iframe tag

Related

Rails, iframe login doesn't work IE9

I am using Rails 2.3.5
What I am trying to do is, by using iframe, I am embedding another website's log in screen into my own website.
Problem is starting when I try to "log in" the website inside the iframe. It is working perfectly fine in Chrome and Mozilla bu not in IE (what a surprise).
To be clear: I am able to see the website inside the iframe only thing that I couldn't do is logging in.
Possible problem: I made an extensive research and I learned because the IE doesn't remember my session (doesn't set cookies) I am not able to log in the site inside the iframe.
p.s : using divs probably won't work for me because if I use div and then log in (hit submit button of that website) then I will end up the website inside my div (inside my iframe right now). I need to stay in my own website.
I am going to band my head against the wall, so waiting for you comments.
(please comment if you need to see some code source or sth. else)
Thanks.
That's worked for me:
"Internet Explorer > Settings > Internet Options > Privacy > Sites" and then I added the name of the website inside my iframe, done.

How to test mobile web app built with jQuery Mobile with Optimizely?

I've built a mobile web app with jQuery Mobile. In the index.php file, there're multiple pages declared as data-role="some_page_name" and their urls are like index.php#my_profile.
Now I want to use Optimizely to do A/B test on one of the pages. I created one variation and let it redirect index.php#my_profile to a new page, url: index_b.php#my_profile. But I have trouble linking this page to other not-in-test pages.
For example, if I have a link in index_b.php#my_profile like this:
My Favorite
It can't link to the favorite page in index.php. And sometimes if it does, you navigate to other pages, you'll never go back to the B version/variation.
Looks like Optimizely can't adapt to the jQuery Mobile multi-page structure.
Any solutions?
You can try to add more tag in href link, such as,
My Favorite
<a href="index.php#favorite" data-ajax='false'>My Favorite</a>
You also could use full link path with http:// prefix.
My Favorite
And an other option is add a link click JavaScript method. You can control the JavaScript content.
It should be okay on optimizely or visual website optimizer.

jQuery Mobile: How can I link to an external page without breaking web app view?

I created a web app (without browser chrome) which loads most of its pages locally from index.html. Now I have one page which i can not integrate into index.html, since it has to be refreshed when loaded. I placed it on the same server and called it stats.html and link to it like this:
Stats
When I click this link, the browser pops to the front instead switching to the page without browser chrome.
How can I link to an external page in a way that it still looks like one app?
I appreciate any hints to solve this problem.
just found https://github.com/mrmoses/jQuery.stayInWebApp that seems to be the solution.

Embedding URL in Ruby Rails?

I'm having a bit of an issue linking to a web app in my Rails application. Basically, I have a layout for the application, made of a header, sidebar, and main_content, and I want to be able to open the web app in the main window, sort of like a frame would do. How do I go about this? I tried using a simple link_to command, but that opened a new window, even when I included the :target parameter. I tried to set up a controller for it, and use that, but I couldn't find a way to link it to the app. Note that while I do own the app, I can only access it through a URL: I don't store it locally.
Sorry if this is an amateurish question, I'm still learning rails, and I'm very much in the beginner stage.
Assuming that the link you're using is to a full webpage rather than a fragment that's designed to be used inside another page, your best bet is an iframe embed.
All link_to does is render a regular hyperlink, and that will always load a new page (whether it's in a new window, tab, or replaces the current page).

How can I load iOS webclip links in the same window?

After loading up a Webclip with some links in it, clicking a link launches Mobile Safari instead of loading the link in the same window. Is there a way to prevent the link loading in Safari instead of the Webclip instance? I'm trying to mock up a mobile app just using PHP on my local Apache installation.
According to the Apple docs it looks like external page links will always open in Mobile Safari:
In this mode any external links will be opened in Safari on
iPhone, meaning that you will have to keep your web application to a
single page and use Ajax to update parts of that page.
In addition to the option of using a single page loading new content with AJAX, you can use the JavaScript self.location=URL; return false on hyperlinks that must stay within the application. This can be added to the HTML code directly, or with another script upon loading the page.
If you are using jQuery, I would recommend something like this:
$('a:not([target])').click(function(){
self.location = $(this).attr('href');
return false;
});
Obviously this script should be ran after the HTML has loaded, to ensure that it actually attaches to the A elements onClick event.

Resources