chrome app add local script and script from url - javascript

I'm starting a chrome app. But things like this doesn't work for security reason.
<script src='https://code.jquery.com/jquery-1.11.0.min.js'></script>
<script src='app.js'></script>
So how to add those 2 kind of script to my app?
I tried different things in the manifest file but none of them have been successfull

The simplest way to avoid security issues is to download jquery-1.11.0.min.js and place it in your script directory. This will ensure you won't have security SOAP issues. Then include the files like this:
<script src='/example_local_directory/jquery-1.11.0.min.js'></script>
<script src='/example_local_directory/app.js'></script>

Related

Do external script redirects without .js extension work on all browsers

I have a script snippet on third party websites like this:
<script src="https://www.example.com/a" async></script>
This opens this php file:
header('Location: https://storage.googleapis.com/example/example.js', true, 301);
My question is, will this work properly on all browsers? In the same way as something like this would:
<script src="https://www.example.com/a.js" async></script>
If not, what would you suggest?
File extensions are irrelevant in URLs. Content-Type matters, the text of the URL does not.

force react.js to load depenencies via ssl

I have a Play framework app which handles sensitive data and so enforces SSL.
I'm building a frontend with React.js , but when I try to load
<script src="https://fb.me/react-0.11.1.js" type="text/javascript"></script>
<script src="https://fb.me/JSXTransformer-0.11.1.js" type="text/javascript"></script>
I get the error
[blocked] The page at 'https://localhost:9443/react' was loaded over HTTPS, but ran insecure content from 'http://dragon.ak.fbcdn.net/hphotos-ak-xpf1/t39.3284-6/10173493_255140104677950_2108691993_n.js': this content should also be loaded over HTTPS.
How can I enforce that the transient dependencies are also loaded via https?
The Facebook "CDN" for React doesn't work over HTTPS right now, sorry. You can instead use cdnjs:
http://cdnjs.com/libraries/react
Your script tags will look something like
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.11.1/JSXTransformer.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.11.1/react.js"></script>

jquery as a local resource

When I use the following header
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
There is no error in my HTML file. But I am facing a problem. Every time I am loading this page , there is the need for internet connectivity.
I have developed an webpage through which some instruments would be controlled through node.js acting as a server. This would be accesible in the intranet (between local computers in LAN) only.
Is there any method to use jquery as a local resource, i.e. If i download and save these files and use it from the local hard disk.
I saved both the files jquery-1.8.3.js and jquery-ui.js in the same folder as the html and used it with <script src="/jquery-ui.js"></script> it is giving resource not found 404 error.
If the .js file is in the same folder as the .html, then you should be able to include it with
<script src="jquery-1.8.3.js"></script>
Download the jquery and put it in your scripts folder and use like this
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="scripts/jquery-1.8.3.min.js"><\/script>')</script>
This will first check for the CDN if exist it will load from CDN other wise it will take local one
uses of CDN are in this link

How include custom javascript library to google site?

Please, help include custom javascript library "jquery-EmbedPicasaGallery.js" to google site.
I tried 3 methods and always have error:
failed to load external url jquery-EmbedPicasaGallery.js
I tried:
.
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://googledrive.com/host/0BziEumkvYpL6Ql9NRFhET2FXM1E/jquery-EmbedPicasaGallery.js"></script>
.
<script type="text/javascript" src="https://docs.google.com/uc?id=0BziEumkvYpL6ZmlHZ2FWQ1NrVG8"></script>
.
<script type="text/javascript" src="https://docs.google.com/uc?id=0BziEumkvYpL6ZmlHZ2FWQ1NrVG8&export=download"></script>
Have you tried downloading the script and running it from your own server?
Is your site being tested on a server, or locally?
It is common for errors to occur when attempting certain things locally, so make sure to run on a server, especially in cases involving php, ajax, canvas image data, http headers, and cookies, to name a few.

JQuery UI Tabs break in secure (https) page

I'm using the out-of-the-box JQuery UI tabs- they work fine on an unsecured page but not on the secure https:// page.
I'm calling my scripts like this:
<script src="//code.jquery.com/ui/1.8.22/jquery-ui.min.js" type="text/javascript"></script>
<script src="//jquery-ui.googlecode.com/svn/tags/latest/external/jquery.bgiframe-2.1.2.js" type="text/javascript"></script>
<script src="//jquery-ui.googlecode.com/svn/tags/latest/ui/minified/i18n/jquery-ui-i18n.min.js" type="text/javascript"></script>
Examples here:
http://ntcla.com/fb-static.php and
https://ntcla.com/fb-static.php
(see map at the bottom of the page)
Any help is appreciated!
It looks like there is an SSL cert error on the code.jquery.com link. You could just download it and host it on your own site/CDN.
SSL certificate error will be thrown when you try using any js in following manner
download above files and copy them on your server and access them using relative paths on your script

Categories

Resources