I set up a brand new project using the PhoneGap starter template in Visual Studio. The template works as expected, but if I try to add jquery mobile to the page, and call a function from it, its reported that jQuery is undefined.
here is my template javascript:
<script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"></script>
<script type="text/javascript" src="jquery.mobile.min.js"></script>
<script type="text/javascript">
document.addEventListener("deviceready",onDeviceReady,false);
// once the device ready event fires, you can safely do your thing! -jm
function onDeviceReady()
{
document.getElementById("welcomeMsg").innerHTML += "Cordova is ready! version=" + window.device.cordova;
console.log("onDeviceReady. You should see this message in Visual Studio's output window.");
jQuery("#welcomeMsg").html("blah");
}
</script>
My CordovaSourceDictionary.xml looks like it is ok too:
<?xml version="1.0" encoding="utf-8"?>
<!-- This file is auto-generated, do not edit! -jm -->
<CordovaSourceDictionary>
<FilePath Value="www\cordova-1.5.0.js"/>
<FilePath Value="www\index.html"/>
<FilePath Value="www\jquery.mobile.min.js"/>
<FilePath Value="www\master.css"/>
</CordovaSourceDictionary>
but upon trying to debug the WP7 app, i get these errors:
ScriptNotify :: Error:"'jQuery' is undefined"
Log:"Error in success callback: Connection1 = 'jQuery' is undefined"
In the code you posted, you aren't including the jQuery core... jQuery Mobile is built on-top-of jQuery Core so the core must be included before jQuery Mobile or jQuery Mobile will not function.
Notice on the jQuery Mobile download page the order of includes (mobile.css, then core JS, then mobile JS):
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
Source: http://jquerymobile.com/download/
Related
I am using the simple arjs example to my angular project but i cannot get any results using the hiro marker.
This is the code:
<a-scene embedded arjs>
<a-box position='0 0.5 0' material='opacity: 0.5;'></a-box>
<a-marker-camera preset='hiro'></a-marker-camera>
</a-scene>
When I point my smartphone to a hiro marker nothing happens.
Is this because my device is not supporting AR? I have a Xiaomi redmi note 6 pro.
I read that in order for the AR to work on the device I need to have AR Google services which are not supported by my device.
Does arjs need AR google services in order to work? If not what are
the other reasons?
PS.
I am on https and the camera is open.
I am on an angular project and I am importing the scripts on the
index.html head
these are the scripts:
<script src="https://aframe.io/releases/0.8.0/aframe.min.js"></script>
<script src="https://cdn.rawgit.com/jeromeetienne/AR.js/master/aframe/build/aframe-ar.js"> </script>
As Far As I Know arjs does not need AR Google Services in order to work
I think the problem is you need to put the your object, which is <a-box>, inside the <a-marker>
Try:
<!DOCTYPE html>
<html>
<script src="https://aframe.io/releases/1.0.0/aframe.min.js"></script>
<!-- we import arjs version without NFT but with marker + location based support -->
<script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js"></script>
<body style="margin : 0px; overflow: hidden;">
<a-scene embedded arjs>
<a-marker preset="hiro">
<a-box position='0 0.5 0' material='opacity: 0.5;'></a-box>
</a-marker>
<a-entity camera></a-entity>
</a-scene>
</body>
</html>
You can also see another example here: https://github.com/AR-js-org/AR.js/
Currently, I had developed Microsoft Graph ChatBot which retrieves the data from SharePoint but when I debug in Emulator its work, but I deploy in WebChat the result did not display.
The results from Emulator,
The results from WebChat
Anyone know how to solve it or suggestion?
There are currently two versions of Web Chat: Gemini and Scorpio. Test in Web Chat is still using the older version - Scorpio - which unfortunately does not support OAuth Cards. The BotFramework Development Team is working to update Test in Web Chat, but if you need an immediate fix, I would recommend creating your own web page that uses the latest version of Web Chat. Take a look at the sample code below.
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>WebChat</title>
<script src="https://cdn.botframework.com/botframework-webchat/master/webchat.js"></script>
<style>
html, body { height: 100% }
body {
margin: 0;
}
#webchat {
height: 100%;
}
</style>
</head>
<body>
<div id="webchat" role="main"></div>
<script>
(async function() {
// Note, for the simplicity of this example, we are simply using the Web Chat Secret here;
// however, it is recommended that you create a backend REST API to generate and manage
// tokens for production.
window.WebChat.renderWebChat({
directLine: window.WebChat.createDirectLine({ secret: '<WEB_CHAT_SECRET>'}),
}, document.getElementById('webchat'));
})().catch(err => console.log(err));
</script>
</body>
For more examples of how to get started with Web Chat, take a look at the Web Chat samples.
Hope this helps!
I am working on a simple project where my primary requirement is to use Microsoft BotFramework's WebChat to create a custom inline app. I want to add a button at the header which will be a reset button, which will restart the session and remove all the messages but will maintain the same conversation ID. I am not finding any useful documentation on how can I send a message to the bot from a button click. Also How can I notify the bot which conversation's session needs to be erased.
This is the sample code I am using,
<!DOCTYPE html>
<html>
<head>
<link href="stylesheets/botchat.css" rel="stylesheet" />
</head>
<body>
<div id="bot"/>
<script src="javascripts/botchat.js"></script>
<script>
BotChat.App({
directLine: { secret: '' },
user: { id: 'you' },
bot: { id: 'agent' },
sendTyping: true,
resize: 'detect'
}, document.getElementById("bot"));
</script>
</body>
</html>
I have also checked that we have something called deleteUserData event, but I am not sure how do I use this in my scenario.
You can do this via back channel. In a nutshell, what will happen is the web page that's hosting webchat will connect to the same DirectLine instance your webchat is using, which will allow the page to communicate with the bot. You can then set up a handler for a reset event which will call the appropriate code to handle resetting the state.
You can see how to set up back channel here:
https://github.com/MissionMarsFourthHorizon/operation-max/tree/master/Node/exercise8-BackChannel
Try session.clearDialogStack(); or delete session.userData;
I'm trying to get simple code for modernizr js to say whether or not a browser can support geolocation api. Here's my code.
<script src="js/vendor/modernizr-2.8.3.min.js"></script>
<!-- check if geolocation works on browser -->
<script>
if(Modernizr.geolocation)
{
document.getElementById("geoConfirm").innerHTML = "This will work on this browser!";
}
else{
document.getElementById("geoConfirm").innerHTML = "This will not work on this browser";
}
</script>
<p id="geoConfirm">Test</p>
It's such simple code but it's not working, and it's bugging me because there's barely anything to go over. Thoughts?
I keep reading that the console.log needs to come after the onDeviceReady function, but I don't see any onDeviceReady functions in the cordova.js. Do I need to write my own? Does anybody know what the function would look like? What if I just wanted to console log "hello"?
Also, I noticed that cordova.js is not included as a script in the index.html. I'm assuming it needs to be if I want to see anything logged in the xcode console?
If you create the phonegap project by command line interface as described in their site
You should include cordova-3.x.x.js in your html head.
<head>
<script type="text/javascript" src="cordova-3.x.x.js"></script>
<script>
function onLoad() {
document.addEventListener(
'deviceready', onDeviceReady, false);
}
function onDeviceReady() {
// do Something!
// example: display a Cordova Console
// see docs.phonegap.com for full details
console.log("HELLO...");
}
</script>
</head>
<body onload="onLoad();">
Inorder to use the debug console in phonegap, you should add the plugin to the project by CLI
Type this command in Terminal
$ cordova plugin add org.apache.cordova.console