dojo mobile with phonegap doesn't work properly - html

I start write application using phonegap and dojo in Eclipse. Phonegap, without dojo work properly on android emulator and in chrome with ripple addon. Problem is when I added dojo to project. I use phonegap 2.7.0 and dojo 1.9.0.
I was using: http://www.ibm.com/developerworks/web/library/wa-mobappdev1/ tutorial to setup this.
How I setup dojo:
index.html file:
<!DOCTYPE HTML>
<html>
<head>
<title>PhoneGap</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="stylesheet" href="libs/dojo/dojox/mobile/themes/android/android.css" type="text/css" media="screen" title="no title" charset="utf-8"/>
<script type="text/javascript" src="libs/dojo/dojo/dojo.js" djConfig="parseOnLoad:true"></script>
<script type="text/javascript" charset="utf-8" src="cordova-2.7.0.js"></script>
<script type="text/javascript" charset="UTF-8" src="funkcja.js"></script>
<script type="text/javascript">
dojo.require("dojox.mobile.parser");
dojo.require("dojox.mobile");
dojo.require("dojox.mobile.app");
dojo.require("dojox.mobile.Button");
</script>
</head>
<body>
<div dojoType="dojox.mobile.View" id="site" selected="true">
<h1 dojoType="dojox.mobile.Heading">Index</h1>
<div>
<input dojoType="dojox.mobile.Button" type="button" id="submit" name="submit" value="Button" onclick="loguj()"/>
</div>
</div>
</body>
</html>
In emulator I get a blank screen.
In chrome using ripple I get just html without dojo scripts. Scripts are include. In console I get an errors:
Console was cleared ripple.js:37
Ripple :: Environment Warming Up (Tea. Earl Gray. Hot.) ripple.js:37
Uncaught SyntaxError: Unexpected token u Insertion.js:1
GET http://localhost/config.xml 404 (Not Found) ripple.js:50
cordova :: Initialization Finished (Make it so.) ripple.js:37
GET http://localhost/libs/dojo/dojo/fx/Toggler.js 404 (Not Found) ripple.js:50
Error {src: "dojoLoader", info: "xhrFailed"} dojo.js:15
GET http://localhost/cordova_plugins.json 404 (Not Found) ripple.js:50
Uncaught SyntaxError: Unexpected token < cordova-2.7.0.js:6816
GET http://localhost/libs/dojo/dojo/resources/blank.gif 404 (Not Found) app.js:15
deviceready has not fired after 5 seconds. cordova-2.7.0.js:6672
Channel not fired: onPluginsReady cordova-2.7.0.js:6665
Channel not fired: onCordovaReady cordova-2.7.0.js:6665
Channel not fired: onCordovaConnectionReady cordova-2.7.0.js:6665
deviceready has not fired after 5 seconds. cordova-2.7.0.js:6672
Channel not fired: onPluginsReady cordova-2.7.0.js:6665
Channel not fired: onCordovaReady cordova-2.7.0.js:6665
Channel not fired: onCordovaConnectionReady cordova-2.7.0.js:6665

Dojo tries to load his js files, but can't. I think this answer may work for you too:
PhoneGap / Cordova 1.6 and dojo 1.7.2 AMD works from web, not from local?
Set the djConfig of dojo.js to djConfig="async:false,parseOnLoad:true"
AND load cordova.js before dojo.js !
If it doesnt work & you want to start developing, try to use dojo.js from the web.

Just create a cordova_plugins.json file into www with {} inside.
Alternatively, you can comment out lines 6395->6415 from cordova-2.7.0.js.

I followed the same tutorial on IBM Website and it also did not work.
To make it work I had to do the following:
Remove djConfig="parseOnLoad:true"
Replace
dojo.require("dojox.mobile.parser");
dojo.require("dojox.mobile");
dojo.require("dojox.mobile.app");
dojo.require("dojox.mobile.Button");
with:
require(["dojox/mobile/parser", "dojox/mobile", "dojox/mobile/app", "dojox/mobile/Button", "dojo/domReady!"],
function(parser) {
parser.parse();
}
);

Related

HPP Customizatoin

I'm experiencing with rxp-hpp.js and would like to customize the HPP form displayed in my iframe.
I have followed instructions at https://developer.globalpay.com/ecommerce/hosted-solution/customization but I'm unable to get HPP to use my CSS.
Any help would be appreciated.
My html page
<html>
<head>
<title>HPP P2 (hpp:body)</title>
<meta charset="UTF-8">
<script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
<script src="/lib/rxp-hpp.js"></script>
<link rel="stylesheet" type="text/css" href="./css/styles.css">
<script>
// get the HPP JSON from the server-side SDK
$(document).ready(function () {
$.getJSON("/examples/hpp/proxy-request.php?slug=process-a-payment", function (jsonFromServerSdk) {
RealexHpp.setHppUrl('https://pay.sandbox.realexpayments.com/pay');
RealexHpp.embedded.init("payButtonId","targetIframe","/examples/hpp/response.php", jsonFromServerSdk);
});
});
</script>
</head>
<body>
<hpp:body />
<input type="submit" id="payButtonId" value="Checkout Now 3.6.1" />
<br />
<iframe id="targetIframe" height="700" width="400" style="display:none;"></iframe>
</body>
</html>
As mentioned in the documentation, all images or CSS used in the template must be referred to locally on our server; no absolute URLs to external images or CSS. You'll need to include the image files along with the template page.
You will need to create this template (JavaScript is not needed) and then send it to the support team, which will upload it to the HPP server, under the merchant provided by you - once the process is completed, you will be able to see the styling being loaded inside the HPP. The support team can be contacted at ecomsupport#globalpay.com

How to launch application threw "a href" on the foreground instead of background

In my project i am using "a href" to launch windows application.
<a href={`some app here`}>
//Similar logic to mailto
The problem is, that it launch it on the background instead of bringing it up on the foreground.
Basically it just sits and blinks in Windows task bar instead of automatically appear on top of the screen.
Does anyone knows is there any specific way how with a tag bring it on the foreground automatically instead of background?
You would most likely have to use javascript for this. If that is fine, use this code here:
<html>
<head>
<title>Application Executer</title>
<HTA:APPLICATION ID="oMyApp"
APPLICATIONNAME="Application Executer"
BORDER="no"
CAPTION="no"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
SCROLL="no"
WINDOWSTATE="normal">
<script type="text/javascript" language="javascript">
function RunFile() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/windows/system32/notepad.exe", 1, false);
}
</script>
</head>
<body>
Run the Notepad application
</body>
</html>
You would replace the notepad.exe in c:/windows/system32/notepad.exe with the application file that you want to run. Hope this helps!

Mixed Content using Google Maps

I use gmaps show Map in my web site.
MY CODE
<div class="col-md-12" >
<script type="text/javascript" content="zk.googleAPIkey='***MyKey***'" />
<gmaps id="gmaps" zoom="${initialZoom}" lat="${initialLatitude}" lng="${initialLongitude}" width="100%" height="350px" showSmallCtrl="false" >
<gmarker id="marker" content="" visible="${false}" />
</gmaps>
</div>
In my local server work fine but in my productive server with https don't work and i have this error:
EXCEPTION
zk.wpd:20 Mixed Content: The page at 'https://www.domain.com/' was loaded over HTTPS, but requested an insecure script 'http://www.google.com/jsapi?key=***MyKey***'. This request has been blocked; the content must be served over HTTPS.loadScript # zk.wpd:20
added the following and solved my problem
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"/>
in head
I solvel my problem remplace zk.googleAPIkey=****key*** for https://maps.googleapis.com/maps/api/js?key=****key***
The problem is this tag zk.googleAPIkey because your value is http://maps.googleapis.com/maps/api/js? the problem is the http
Before
<script type="text/javascript" content="zk.googleAPIkey='***MyKey***'" />
After
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=***key***" />
From ZK demo of google maps :
<gmaps version="3.26" id="gmaps" width="520px" height="400px" showSmallCtrl="true" protocol="https">
Can you try adding the protocol property?

Installing Jasmine failing

I'm trying to get Jasmine to work on my website. This is my HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Jasmine Spec Runner v2.1.3</title>
<link rel="stylesheet" type="text/css" href="/Content/css/jasmine.css" />
<script src="/Scripts/UnitTesting/boot.js"></script>
<script src="/Scripts/UnitTesting/jasmine-html.js"></script>
<script src="/Scripts/UnitTesting/jasmine.js"></script>
<!-- include source files here... -->
<!-- include spec files here... -->
<script src="/Scripts/UnitTesting/HelloWorldSpec.js"></script>
</head>
<body>
</body>
</html>
And HelloWorldSpec.js:
function helloWorld() {
return "Hello world!";
}
describe("Hello world", function () {
it("says hello", function () {
expect(helloWorld()).toEqual("Hello world!");
});
});
When I load this page, I get:
ReferenceError: jasmineRequire is not defined
ReferenceError: describe is not defined
I thought I got the reference to the JS files wrong. But when I look at the page source, and click on one of the js links, for example, "/Scripts/UnitTesting/boot.js", I see the source code, so it appears the files are loaded succesfully. What's going wrong here?
The boot.js file should be loaded after jasmine.js and jasmine-html.js Otherwise what would it boot? The correct order that you should include the files is:
jasmine.js
jasmine-html.js
boot.js
http://jasmine.github.io/2.0/boot.html
Starting with version 2.0, this file “boots” Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project’s specs. This file should be loaded after jasmine.js and jasmine_html.js, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.

JSON update not working

I tried to insert this into sole using the update/json handler:
[{"id":"abc","text":"you have been served"}]
But Solr gives me this hard-to-troubleshoot message. I am using Scala + Dispatch HTTP, whic is new for me. I am kinda experienced with Solr, but this error message is unhelpful. What exactly is this message?
I am using the latest version 3.6, using the start.jar (for testing) and have disabled lazy loading for update/json.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 404 NOT_FOUND</title>
</head>
<body>
<h2>HTTP ERROR: 404</h2>
<p>Problem accessing /update/json. Reason:
<pre> NOT_FOUND</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>
Instead of
localhost:8983/solr/update...
I was careless enough to
localhost:8983/update...
My bad.