1

enter image description hereThere are some javaScripts which is essential to load a graph in my web page. But the problem is all of the scripts blocked by my browser.Therefore I need to give permission from my browser to execute those scripts. But I need to resolve that from from my code level.

http://code.highcharts.com/modules/no-data-to-display.js

I download the relevent js files from highcharts and set the source for that js files. But the problem is when I run from My netbeans there will be no issues. But when I try to run it by deploy in a server these scripts will not be run. And I need to give permission from my browser. Are there any solution to resolve the problem from code level?

usenanayake
  • 189
  • 2
  • 17
  • Possible duplicate of [How to Include CSS and JS files via HTTPS when needed?](https://stackoverflow.com/questions/2725523/how-to-include-css-and-js-files-via-https-when-needed) – Pete Jun 27 '19 at 10:38
  • 1
    How useful would a protection be, if you can just add some programming tricks to circumvent the security features in browsers. Deliver your content via https protocol, which is the demanded action. – Teemu Jun 27 '19 at 10:39

1 Answers1

2

Because your page is HTTPS, the scripts it loads should be loaded via HTTPS. The one you've listed (http://code.highcharts.com/modules/no-data-to-display.js) is available via HTTPS (https://code.highcharts.com/modules/no-data-to-display.js). If the others aren't, then perhaps copy them locally and serve them through your HTTPS server.

One common technique here (provided you know the resources area available via both HTTP and HTTPS) is to use a protocl-relative URL for the scripts:

<script src="//code.highcharts.com/modules/no-data-to-display.js"></script>

In a page loaded via HTTPS, that will be https://..., but on a page loaded via HTTP, it'll be http://... (and this is standardized behavior, not an undocumented hack).

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875