Why i cant connect to external link .js ? (Using Xcode plugin phonegap) - javascript

<!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".

Related

Send data to google script web app periodically

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

How does one block direct browser access of client side include files in angularjs?

In an angularjs application, the index.html page is served when a user types mydomain.com into their web browser. But the page has client side include pages, including index_firstinclude.html. But there is a hole in the app because any user (or webcrawling spider bot) can see unintended content if they type mydomain.com/index_firstinclude.html into their browser. This could lead to automated links to the unintended include urls from search engines and other sites. How can I make sure that the user is NOT able to see the content of index_firstinclude.html if they type mydomain.com/index_firstinclude.html in their browser?
Here is index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="resources/css/my.css">
</head>
<body ng-app="myApp">
<script src="js/lib/angular.js"></script>
<script type="text/javascript" src="myController.js"></script>
<div ng-controller="myController">
<table width=100%>
<tr>
<td align="center">
<div ng-include="'index_firstinclude.html'"></div>
</td>
</tr>
</table>
</div>
</body>
</html>
In your code example you include the index_firstinclude.html into your main page, so it's content will be visible to the site visitors and those bots who process javascript sites.
You can disable loading any specified files for specific useragents by configuring your web server.
Also, if there are pages with content for authorized users only, you could serve them with server-side authorization check.

can not able to load dojo.js

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>

Unable to execute JQuery into my Andro App, but the same executes in Chrome

Here I am making a simple App which should produce the output similar to this --->
Visit http://i43.tinypic.com/2j8mrl.jpg
But the output doesn't appears to be so
I have installed Apache cordova, ant and set all my environment variables.
I created the HelloWorld App using commandLine. I edited the file in /asset/wwww folder And following is the code for index.html
<!DOCTYPE HTML>
<html>
<head>
< title>PhoneGap Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script
</head>
<body>
<div data-role="page" id="main">
<div data-role="header">
<h1>PhoneGap Demo</h1>
</div>
<div data-role="content">
Hello, this is JQuery Mobile running in Apache Cordova
</div>
</div>
</body>
</html>
Can you please tell me why is this happening..
I think you forgot to add cordova.js file to your html,
also you have to update your access policy to allow all urls, update your config.xml file with the following code:
<access origin="*" />

I'm trying to include JQuery in Dreamweaver, but it's not being recognized. Not as file, not from a CDN

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

Categories