As I am trying my hands on dojotoolkit, I try to run (open) following html code in my browser, as they said on tutorial, but my browser does not able to load dojo.js
At time of troubleshooting I found that source URL is converted like following:
file://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial: Hello Dojo!</title>
</head>
<body>
<h1 id="greeting">Hello</h1>
<!-- load Dojo -->
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js"
data-dojo-config="async: true"></script>
<script>
require([
'dojo/dom',
'dojo/dom-construct'
], function (dom, domConstruct) {
var greetingNode = dom.byId('greeting');
domConstruct.place('<em> Dojo!</em>', greetingNode);
});
</script>
</body>
</html>
Use a real webserver, rather than browsing from the filesystem.
While Frank is correct in that adding an explicit protocol to the URL will fix this particular issue, you are inevitably going to run into other issues anyway, such as XHR being locked down from the file:// protocol. The protocol-relative URL you were originally using will work fine if you test on a real webserver which serves http or https.
you need to add http as the protocol for the dojo.js file source.
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js"
data-dojo-config="async: true"></script>
Also best practice is to add library files in the head tag instead of the body tag.
<head>
<meta charset="utf-8">
<title>Tutorial: Hello Dojo!</title>
<!-- load Dojo -->
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js"
data-dojo-config="async: true"></script>
</head>
Related
I am doing a small google script web app to update data from google sheet every 30 minutes. I've tried to use page refresh method but it is impossible because the web app show a blank page whenever refresh. So, is there any way to reload web app data periodically?
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<meta http-equiv="refresh" content="1"> <!--this reload blank page-->
</head>
<body>
<div><b class="alert alert-danger">SẮP HẾT NHỰA</b>
</div>
<div class="ggsheetdata">
</div>
<script>
</script>
</body>
</html>
You can use the Javascript setInterval function to call a Javascript Function which in turn calls a google.script.run.withSuccessHandler(function(data){//update data here}).getData();
where getData() is a Google Apps Script function that returns the required data back the SuccessHandler.
However, your webapp must be able to be running in the browser at all times for this to work.
setInterval
I've tried including it in my files, and from a CDN. I followed a tutorial about it, although it's hardly a tutorial to follow since all i had to do was include the link after <head>. Still, it's not being recognized and plugins aren't being recognized and just appear as text. Does anyone have an idea what could be the problem? If it's perhaps a setting in dreamweaver that has to be changed?
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<link href="myfirststylesheet.css" rel="stylesheet" type="text/css">
<title>Hallo wereld</title>
</head>
</html>
Its worth noting that, http or https in src hinders the inclusion of the cdn files at times.Remove the protocol and try this way....this way, it would take either http or https depending on the nature of hosting server
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script>
EDIT
Further Read on why this helps ( if not running the file from computer but through some server, even localhost):
Can I change all my http:// links to just //?
http-and-https-with-google-cdn
I have a problem when loading the following javascript libraries.
The error that I'm getting is:
Failed to load resource (22:09:18:125 | error, network)
at http://localhost:8383/HTML5WebApp/js/libs/jquery-1.8.3/jquery.min.js
Failed to load resource (22:09:18:172 | error, network)
at http://localhost:8383/HTML5WebApp/js/libs/jqueryui-1.9.2/jquery-ui.min.js
I am developing a HTML5 App, my src for the libraries I want for my App inside head tags:
<title>HTML5 WebApp</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="js/libs/jquery-1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="js/libs/jqueryui-1.9.2/jquery-ui.min.js"></script>
Using Netbeans IDE With Chrome Extension.
Ensure that the javascript files jquery.min.js and jquery-ui.min.js are in the correct path as specified in head tags :js/libs/jquery-1.8.3/jquery.min.js and js/libs/jqueryui-1.9.2/jquery-ui.min.js
To avoid this
Download JS Library on here
<script src="file_name.js"></script>//ex <script src="jquery-2.1.4.min.js"></script>
some times this may occur when you seems offline on your browser(No Internet Connection)
<!DOCTYPE HTML>
<html>
<head>
<title>Doctor List</title>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<link rel="stylesheet" href="css/jquery.mobile-1.0rc1.min.css" />
<link rel="stylesheet" href="css/styles.css" />
</head>
<body>
<div id="employeeListPage" data-role="page" >
<div data-role="header" data-position="fixed">
<h1>Doctor</h1>
</div>
<div data-role="content">
<ul id="employeeList" data-role="listview" data-filter="true"></ul>
</div>
</div>
<script src="js/jquery.js"></script>
<script src="js/jquery.mobile-1.0rc1.min.js"></script>
<script type="text/javascript" src="http://panchoslimi.bugs3.com/MMC/js/DoctorList.js"></script>
</body>
Why scr="http://panchoslimi.bugs3.com/mmc/js/DoctorList.js" not working ? btw i need DoctorList.js on server side for my php file work. so i dont need doctorlist.js local on my xcode .. any solution ?
When I attempt to load the link repeatedly in a browser (drop it into the URL bar), the source code loaded once. On the other attempts, I get an error message:
Service Temporarily Unavailable
Speak with the person providing the JavaScript code about the server not being reliably available. You might see this behavior, for example, if they use load balancing and only some of their web servers are functioning correctly.
btw i need DoctorList.js on server side for my php file work. so i dont need doctorlist.js local
The code you show is HTML. HTML will execute in the client, not on the server. Your markup to include the script appears to be correct.
JavaScript does not run in PHP. To run it server-side, you need a server-side JavaScript engine.
Try to load your js from local. Just download it and include in your project like scr="/js/DoctorList.js".
I'm using phonegap to build an enyo app. My program works completely fine in chrome and it also works in the ripple emulator service for blackberry. My problem is, when I use the .ipk build for webOS and the .apk build for android, I get the same error:
Not allowed to load local resource: file:///usr/palm/enyo.js
Uncaught ReferenceError: enyo is not defined, package.js:1
Uncaught ReferenceError: enyo is not defined, tests/package.js:1
Uncaught ReferenceError: enyo is not defined, index.html:10
This leads me to think that it must be a problem in my index file, which is:
<!DOCTYPE html>
<html>
<head>
<title>Enyo Bootplate App</title>
<link rel="shortcut icon" href="assets/favicon.ico">
<!-- -->
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <!-- look this up for blackberry ad error -->
<!-- css -->
<link href="build/enyo.css" rel="stylesheet">
<link href="build/app.css" rel="stylesheet">
<!-- js -->
<script src="enyo/enyo.js"></script>
<script src="phonegap.js"></script>
<script src="source/mobile.js" type="text/javascript" ></script>
<script type="text/javascript" src="http://www.blackberry.com/app_includes/asdk/adBanner.js"></script>
<script src="source/gameBanks.js" type="text/javascript"></script>
<script src='https://cdn.firebase.com/v0/firebase-auth-client.js' type='text/javascript'></script>
<script src="https://static.firebase.com/v0/firebase.js" ></script>
<script src="build/enyo.js" ></script>
<script src="build/app.js" onerror="alert('No application build found, redirecting to debug.html.'), location='debug.html';"></script>
</head>
<body class="enyo-unselectable">
<script>
new App().write();
</script>
</body>
</html>
The weird thing is that index.html:10 is a comment (the css comment) so I have no idea how an error could possibly be there. Anyone have any idea why I would be getting this error? Or perhaps what "file:///usr/palm/enyo.js" is? That's not a file in my package.
Also, after messing around with it a bit, adding lines at the top of index.html doesn't change where the error is (index.html:10) so is it possible that the error is referring to some other form of index.html? I went through my commits at github and at no point in time was there anything other than comments at line index.html:10.
Update:
When using any other service to package the apps such as palm-run, it updates my code properly. My builds downloaded off of phonegap are not working properly. Is there any reason why phonegap's build specifically would cause this problem?
Finally solved this problem, phonegap was somehow finding the wrong index.html files. When I downloaded the enyo bootplate, there were some index.html's deep within the api and tools folders. After I removed those, it worked properly.
Strange...not sure what is causing that, but I do see you are trying to load enyo.js twice. I doubt that that is the issue, but it is something you want to clear up.
If you start with the base bootplate project with no changes, does it work to package an ipk/apk?