Get excel as response without sign-in



  • I'm using a simple HTML page , when submit happens ,I'll get the JSON data and the jsreport.render get triggered.

       form.on('submit', function (submission) {
                        var data = submission.data;
                        
                        jsreport.serverUrl = 'http://mydomain.com:5488';
    
                        var request = {
                            
                            template: {
                                shortid: "Sk5M6JGcm"
                            },
                            data: data
                        };
                        jsreport.render('_blank', request);                            
                });
    

    The problem is it will redirect to next page and ask for sign-in page , is there a way it can download the excel without giving the sign-in credentials .

    Can anyone suggest me what code changes I should to solve the problem.

    Thank you.



  • That is the sign in page of jsreport?
    Do you have auth enabled in jsreport?
    If yes, I would recommend to make POST to your own server and make the jsreport request from there.



  • Hi, actually ill put the whole code for better understanding ,

        <head>
      <meta charset="utf-8" />
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <title>JSReport</title>
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link href="https://stackpath.bootstrapcdn.com/bootswatch/4.1.3/materia/bootstrap.min.css" rel="stylesheet">
        <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>    
        <link href="https://fonts.googleapis.com/css?family=Quicksand" rel="stylesheet">
    
    <link rel="stylesheet" href="https://rawgit.com/Augplat-Technologies/FormCSS/master/FormCSS.css"> 
    
       <link rel="stylesheet" href="https://unpkg.com/formiojs@latest/dist/formio.full.min.css">
        <script src="https://unpkg.com/formiojs@latest/dist/formio.full.min.js"></script>
    
    	    <script src="./jsreport.js"></script>
    
        <script type="text/javascript">
          window.onload = function () {
                var id = window.location.href;
                id = id.substring(id.lastIndexOf('/') + 1);
    	
                Formio.createForm(document.getElementById('formio'), 'http://subdomain.domain.com:3002/' + id + '',
                    {
                        breadcrumbSettings: { clickable: false }
                         
                    }
                )
                .then(function (form) {
                        // Prevent the submission from going to the form.io server.
                        //form.nosubmit = true;
    
                         // Triggered when they click the submit button.
                        form.on('submit', function (submission) {
                            
                                var data = submission;
                                jsreport.serverUrl = 'http://subdomain.domain.com:5488';
                                var request = {
                                    template: {
                                        shortid: "Sk5M6JGcm"
                                    },
                                    data: data
                                };
                                jsreport.render('_blank', request);
                                                       
                                
                        });
                    
                    });
            };
        </script>
      </head>
      <body>
    
    	<header class="" style="height:5vh;">
                    <div class="col-md-4">
                            <!-- <img class="img-responsive logo_head" src="./images/New Logo.png" alt="logo"> -->
                    </div>
            </header>
            <section class="main_Section">
                    <div class="modal-body inside_Section" style="padding:0%; margin:0%; ">
                            <div style="" class="Form_Div">
    
                                    <div id="formio" class="col-md-12" style="padding-top: 0%; display: g">
                                    </div>
                            </div>
                        </div>
            </section>
    
      </body>
    </html>
    

    This is my html page , in this i've used the jsreport.js https://github.com/jsreport/jsreport-browser-client-dist , As you can see the code , i have the jsreport sever running in the online , and im using the short it. But when ever i click ill get as the Sign in , Your connection to this site is not private ,
    So how can i directly download the excel as response without any sign in process.

    sorry but i'm just running the JSReport in the online and created a excel template , and in this html page i'm just trying to get the excel , put the data inside the excel and download the file. So can you tell me if this is achievable , need some help.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.