data-turbolinks: false url opening browser in turbolinks-ios - ruby-on-rails

I have my Rails application setup using Turbolinks 5, and have the android application successfully built and shipped and it is working with my data-turbolinks="false". I am starting the iOS application and everything appears to be working except the data-turbolinks="false" links which end opening Safari instead of doing their javascript function tied to the link.
Is this not handled in Turbolinks for IOS and I need to handle myself? I followed the demo application pretty closely to get started. I am new to Swift and iOS. I can edit with any code needed. Any help is appriciated, Thank You.

I found a way to do this. Since, these are event links you just need to attach click event to prevent the default. like so
$('.event-link').click(function(e) {
e.preventDefault();
})
Now apply the event-link class to the link.

Related

Issue with multi-page navigation using jQuery Mobile Framework in IBM Worklight [duplicate]

This question already has an answer here:
How to change between pages using Jquery Mobile in Worklight
(1 answer)
Closed 8 years ago.
I am developing a sample mobile banking app in IBM Worklight V6.2 using the jQuery Mobile Framework. I read the Getting Started Documentation on IBM Worklight and it mentions a way to implement multi-page navigation using fragments. However, it also states that if you are using a JavaScript UI Framework, use its API's instead.
I read up on the jQuery Mobile pagecontainer method and am implementing it as below:
<li>Branch Locations</li>
However, I get the issue that the linked page loads after clicking the link but the original page then reloads. Could someone explain to me why this is happening? Is this a known issue?
I found the problem. I had a link to the
<script src="jqueryMobile/jquery.mobile-1.4.3.js"></script>
In the linked pages. That is the reason it was reinitializing the original index page.
See this project for a Worklight 6.2-based app using jQuery Mobile 1.4.3's Pagecontainer widget.
In the app, you click on a button to transition from index.html to page1.html by using:
HTML
load page1
JavaScript
function changeToPage1() {
$(':mobile-pagecontainer').pagecontainer('change','page1.html');
}
You may also take a look at the following questions that are answered with explanation and project examples for using changePage.
Note that the projects may be from Worklight 6.0 and 6.1 rather than 6.2 but that does not matter as here it's about the JavaScript, simply review it.
How to change between pages using Jquery Mobile in Worklight
IBM Workligt Single HTML file containing all application pages: How to load new page?
IBM Worklight 6.1 - Why is Cordova code not working when placed in a sub-page?
IBM Worklight - Page fragmentation
IBM Worklight - Navigation errors in a multipage app
In all of them, the idea is that Worklight is a Single Page Application. Thus you cannot load another HTML file and expect the application to continue functioning. By doing so you lose the "context" of the Worklight framework - the references to the included JS files, etc.
Instead, you can use jQuery's load or jQuery Mobile's changePage (deprecated in v1.4, to be removed in v5), to load different "pages". Ample examples are provided above.

Phonegap Build inAppBrowser event does not fire after view change in iOS 6 & 7

I am building a cross platform app using PhoneGap Build, version 3.3.0. The app is a news app, so requires updating of the DOM as different views are loaded. Every time this happens the old page is removed and replaced by the new view render. The app is built around backbone.js , using jQuery and Twig to render the views.
I am using the inAppBrowser to handle links to external sites, and have successfully set these up, using:
<gap:plugin name="org.apache.cordova.inappbrowser" />
in the config, and a link to
<script src="phonegap.js"></script>
in the index.html file. I am then launching the inAppBroswer using
window.open('myURL', '_blank', 'location=yes');
and this works fine the first time I use it in a session. Even if the browser is then closed and another link on the same view is selected, the browser still works.
However, in iOS 6+, if the view is then replaced by another view, then the links in the new view do not fire. The onclick event attached to the link is definitely firing (I can tell by using alerts), but the inAppBroswer does not open. However, if I exit the app and then return to it, the inAppBroswer has opened. It is as if losing the focus on the app fires off the queued event.
I have confirmed this behaviour by placing an alert in the loadstart event handler, this does not fire until exiting the app and returning to it.
I have tried keeping a persistent reference to the the inAppBrowser and destroying the instance after it has has closed. I have also tried calling the .show() method after creating the inAppBroswer instance, but none of this seems to make any difference.
Is this an issue that anyone else has come across? I could not find another question about this specific issue. This only seems to happen in iOS 6 and 7, not in Android.
Thanks
Seem to have solved it, this article looks at the same issue (in a different context):
https://issues.apache.org/jira/browse/CB-2102
One solution that came out of this was to use iframe bridge mode. Instructions are here:
https://groups.google.com/forum/#!msg/phonegap/iNl2M57xPEA/t2BW2kBXsbYJ
I got it to work, by calling the following:
var exec = cordova.require('cordova/exec');
exec.setJsToNativeBridgeMode(exec.jsToNativeModes.IFRAME_NAV);
on the deviceready event, and this now solves the problem for my app.
Hope this helps anyone with the same issue.

Meteor + jQuery Mobile + Phonegap

How to connect jQuery Mobile (meteor add ...)? I understand that you can connect by adding the head, but I do not want to.
I know about how to use Meteor + Phonegap, however, advise which option is better?
Outdated information:
jQuery-Mobile Meteor sample integration and/or integration guidelines
I created a new jQuery mobile (jqm) demo app at jqmdemo.meteor.com
because the "old" demo app (jqm.meteor.com) wasn't working as expected.
You can create a package in your local lib folder to use jqm in meteor (see source code on bitbucket, link is on the demo page).
There's no meteorite package for this at atmosphere yet (mrt add ...). I haven't created one, because I think there are still many things that can be improved in the demo (e.g. popups are not working in the demo).
Also event binding needs to be re-checked because I added the event to the rendered function of the templates with jQuery.on(...).
Attaching the jquery mobile events to the template.[yourtemplate].events({}) handler would be better, but I don't know how to do this.
I can not say anything to phonegap at the moment. Because I haven't tested it.
But at the moment I think that jqm and meteor is a bit slow in performance. If you have a look at the fontawesome-demo inside of the jqm demo you'll notice that it takes quite long to render the >300 icons. Maybe a server side rendering would be better, but I think that's not ready in meteor.

phonegap server communication problem

I know that phonegap does not provide any server communication functionality, I would like to ask any open source framework can do that?If I used jquery-mobile,I won't use phonegap function. because AJAX doesn't work when using phonegap.
you can use Jquery JS file along with jquery-mobile and phonegap . this will let you make AJAX calls

BlackBerry BrowserField executing javascript

I tried a simple javascript [Example: document.getElementById("mydiv").style.display = "none";] on a web page and tested it on BlackBerry 4.5 simulator browser and it worked.
Now I have an app (JRE 4.5 - Eclipse Plugin) with a BrowserField embedded in a browser and I access the same page in the BrowserField. I do have the following code added to my app
myrenderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.JAVASCRIPT_ENABLED, true);
But the java script is not working. Do I need to add custom code to ensure java script executes? Anything in the Event.EVENT_EXECUTING_SCRIPT? Please help!
I simply can confirm I have the same code on OS 4.5 to enable JS, and the page with JS works OK for me. However should also say I don't hide anything on the page via JS, so I can't confirm if the same JS to hide an element works for me.
Also - I don't handle Event.EVENT_EXECUTING_SCRIPT in any way. So I am sure the code you are using to enable JS is enough to expect JS support in your BrowserField.

Resources