When trying to save the PDF file, the following stack trace occurs and the file is not downloaded:
TypeError: Object expected
at API.save (http://localhost:8080/applications/lib/jspdf/jspdf.debug.js:3648:11)
at Anonymous function (http://localhost:8080/applications/js/<my_custom_js_file>.js:288:12)
at Anonymous function (http://localhost:8080/applications/lib/angular-1.5.8/angular.min.js:158:482)
at e (http://localhost:8080/applications/lib/angular-1.5.8/angular.min.js:45:442)
at Anonymous function (http://localhost:8080/applications/lib/angular-1.5.8/angular.min.js:48:300)
Also tried with a simple example and had the same results:
var doc = new jsPDF();
doc.text("hello", 20, 20);
doc.save("table.pdf");
IE does not support native Promise. Therefore, the initialization script fails at line 12016 of Version 1.5.3:
SCRIPT5009: 'Promise' is undefined
jspdf.debug.js (12016,5)
Afterwards, the script is no longer initializing the required context.
A fix should be a 3rd party promise library - I have solved it by including the following resources before including jspdf.debug.js:
<script type="text/javascript" src="/applications/lib/ie-promise/es6-promise.js"></script>
<script type="text/javascript" src="/applications/lib/ie-promise/es6-promise#4/dist/es6-promise.auto.js"></script>
Related
I am trying to use jsPDF, but when I use the CDN URL given below,
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.2.0/jspdf.umd.min.js"></script>
We get the following error,
Summary:4644 Uncaught ReferenceError: jsPDF is not defined
But when I use the one below which is the older version it works,
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js"></script>
Is the new version only for node?
You should use const doc = new window.jspdf.jsPDF(); in the newer verions.
Instead of const doc = new jsPDF();.
Here is where I found it:
https://github.com/MrRio/jsPDF/issues/2972
Trying to get a (what should be) simple module to work: metisMenu
However, unfortunately I'm failing in doing so, apparently something in my Webpacker setup because when loading my page I get the error: Uncaught TypeError: $(...).metisMenu is not a function
There is an issue in loading the module in application.js. The module is being loaded in vendor/assets/javascripts/app.js
I have jQuery correctly installed
the following snippet into the head section makes it work (but this is without the use of Webpaker):
<script src="https://cdn.jsdelivr.net/npm/jquery"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://unpkg.com/metismenu"></script>
.
I've created a github branch. Please help! https://github.com/henkjanwils/metisMenu-error
Please help...I am trying to get openPGP.js working in an existing ASP.Net MVC Web Application.
I first started by adding the following html script tags:
<script src="#Url.Content("~/Scripts/openpgp.min.js")"></script>
<script src="#Url.Content("~/Scripts/openpgp.worker.min.js")"></script>
and I got this error on loading my page:
ReferenceError: importScripts is not defined
So I did some research and added RequireJS to my page, like so:
<script data-main='#Url.Content("~/Scripts/openpgp.min.js")' src="#Url.Content("~/Scripts/require.js")"></script>
Then in the event handler in which I intend to run my decryption logic, I have the following code:
async function decryptBBRecording(commId) {
var openpgp = require(['openpgp']);
await openpgp.initWorker({ path: 'openpgp.worker.js' }) // set the relative web worker path
...
...
...
}
and it is on that "await" line that I am getting
TypeError: openpgp.initWorker is not a function
I'm thinking this is because I have not loaded the openpgp.worker.min.js file. But when I do so via script tag, I get the following errors:
ReferenceError: importScripts is not defined
and when I do so via require(["#Url.Content("~/Scripts/openpgp.worker.min.js")"]); I get this:
Error: Script error for "openpgp"
ReferenceError: importScripts is not defined
Please can you provide me with guidance on how to get this working?
Answer provided here.
You don't have to include openpgp.worker.min.js on the page directly. You also shouldn't need require.js and the call to require. Just include openpgp.min.js on the page, it will globally define openpgp, and then call openpgp.initWorker as you are doing.
I am writing a simple extension to display the users email address using OAuth. When I do this, the above error is returned.
My manifest.json is here: http://pastebin.com/8V0vYBcz
I Think the error is clear, check the folder "JS" in your extension files you will not find file with name "chrome_ex_oauth.html” , maybe you typed the wrong path in the manifest.json like below
"app": {
"launch": {
"local_path": "js/chrome_ex_oauth.html"
}
Or maybe you added a wrong script path
<script type="text/javascript" src="JS/chrome_ex_oauth.js"></script>
may be the write one is
<script type="text/javascript" src="chrome_ex_oauth.js"></script>
I have a featured content slider on my homepage here: etiquetteplus.net
That slider loads fine in old versions of IE and FF. But new versions and with chrome it doesnt.
I get theses errors, but I am not sure what they mean.
ui.core.js:179Uncaught TypeError: Cannot read property ':' of undefined
Uncaught TypeError: Cannot read property ':' of undefined
Uncaught TypeError: Object function (E,F){return new o.fn.init(E,F)} has no method 'widget'
I have tried newer versions of jquery but that didnt help either. Any suggestions? Thanks!
there seems to be allot going on here but the most important thing I see off hand is on line 41 of your source code you include jquery and colorbox like so
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>
<script type="text/javascript" src="http://www.etiquetteplus.net/wp-content/themes/etiquette/js/jquery.colorbox.js"></script>
then on line 86 you load a really really really old versions of jquery
<script type='text/javascript' src='http://www.etiquetteplus.net/wp-includes/js/jquery/jquery.js?ver=1.3.2'></script>
<script type='text/javascript' src='http://www.etiquetteplus.net/wp-content/plugins/wp-faq/js/wp-faq.js?ver=2.9.2'></script>
<script type='text/javascript' src='http://www.etiquetteplus.net/wp-content/plugins/wp-faq/js/jquery/ui.core.js?ver=2.9.2'></script>
<script type='text/javascript' src='http://www.etiquetteplus.net/wp-content/plugins/wp-faq/js/jquery/ui.accordion.js?ver=2.9.2'></script>
i also see this error
Error: Error calling method on NPObject!
Source File: http://www.etiquetteplus.net/wp-content/themes/etiquette/js/sifr.js
Line: 17
in ff error console
then on your html is not valid
on line 210 you have a closing
</a>
tag with no open you spans a span without close etc...
you need to make sure you are using only one version of jquery and you need to validate your html
i use web devloper addon in firefox to help trouble shoot there are all kinds of cool things to help you get a good working site in order. ff only has a built in error console that will help as well
I am sure that there are more problems that what I have shown here. but if you do diligence and comb your code and html with a fine tooth comb you will get it working correctly. If you get stuck post another question (not duplicate of course) and someone will help.
good luck
mcgrailm