Not allowed to navigate top frame to data URL

Not allowed to navigate top frame to data URL

jkathirjkathir Posts: 18Questions: 5Answers: 0

The full html file with text "Full Example code of Export table with Sorting, Searching and Paging(responsive) features" provided in the below link to export data table into different options.
However all the export options doesn't work when tested locally and throws the following error on clicking export options for

file:///C:/Test/libs/tableExport.js:171 Not allowed to navigate top frame to data URL: data:application/json;filename=exportData;base64,W3siaGVhZGVyIjpbWyJTci5ObyIsIk5hbWUiLCJDb3VudHJ5IiwiU2FsYXJ5Il1dLCJkYXRhIjpbWyIwMDEiLCJSYWh1bCIsIkluZGlhIiwiMjAwMDAiXSxbIjAwMiIsIkNoYXJsZXMiLCJVbml0ZWQgS2luZ2RvbSIsIjI4MDAwIl0sWyIwMDMiLCJNZW5zaHJpbCIsIkF1c3RyYWxpYSIsIjcwMDAwIl0sWyIwMDQiLCJHYW5lc2giLCJJbmRpYSIsIjE4MDAwIl0sWyIwMDUiLCJNYWl0aGlsaSIsIkluZGlhIiwiMTIwMDAiXSxbIjAwNiIsIlBhdmFuIiwiSW5kaWEiLCI1MDAwMCJdLFsiMDA3IiwiUmFrZXNoIiwiVVMiLCI3NTAwMCJdLFsiMDA4IiwiTWF5dXIiLCJJbmRpYSIsIjEwMDAwMCJdLFsiMDA5IiwiTmlSUmFOamFuIiwiSW5kaWEiLCI4NTAwMCJdLFsiMDEwIiwiVGFubWF5IiwiQXVzdHJpYSIsIjMwMDAwIl1dfV0=
The following export options doesn't work

JSON, JSON (IgnoreColumn), JSON (With Escape), PNG, PDF

Please let me know.


  • kthorngrenkthorngren Posts: 2,817Questions: 19Answers: 624

    When I go to the page you linked I get this error:
    Uncaught SyntaxError: Invalid or unexpected token (index):218

    That will keep the button from working since your JS stopped executing.


  • jkathirjkathir Posts: 18Questions: 5Answers: 0

    Full HTML code for reference.

    <!DOCTYPE html>   
    <html lang="en">   
    <meta charset="utf-8">   
    <title>Export HTML table to Excel / CSV / PDF / JSON / PNG / WORD / XML / TXT using jQuery</title><meta name="description" content="DataTables is a plug-in for the jQuery JavaScript library."> 
    <link href="" rel="stylesheet">   
    <script src=""></script>
    <link rel="stylesheet" href=""></style>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>
    <!-- export plug-in files start-->
    <!-- <script src="libs/jquery-1.11.1.min.js"></script>-->
    <script type="text/javascript" src="libs/tableExport.js"></script>
    <script type="text/javascript" src="libs/base64.js"></script>
    <script type="text/javascript" src="libs/html2canvas.js"></script>
    <script type="text/javascript" src="libs/sprintf.js"></script>
    <script type="text/javascript" src="libs/jspdf.js"></script>
    <script type="text/javascript" src="libs/jquery.base64.js"></script>
    <script type="text/javascript">
    <!-- export plug-in files end-->
    <!-- Toggle Button code start-->
    $(document).ready(function () {
    $("#exportButton").click(function () {
    <!-- Toggle Button code end-->
    <body style="margin:20px auto">  
    <div class="container">
    <div class="row header" style="text-align:center;color:green">
    <h3>Export HTML table to Excel / Word / PDF / JSON / PNG / XML / CSV / TXT / SQL</h3>
    <button data-toggle="exportTable" id="exportButton" class="btn btn-primary">click here to Export Data</button><br/><br/>
    <div id="exportTable" style="display:none;">
    <a href="#" onClick ="$('#myTable').tableExport({type: 'json', escape: 'false'});"><img src='images/json.png' width="24"/> JSON</a>
    <a href="#" onClick ="$('#myTable').tableExport({type: 'json', escape: 'false', ignoreColumn: '[2,3]'});"><img src='images/json.png' width="24"/> JSON (ignoreColumn)</a>
    <a href="#" onClick ="$('#myTable').tableExport({type: 'json', escape: 'true'});"><img src='images/json.png' width="24"/> JSON (with Escape)</a>
    <a href="#" onClick ="$('#myTable').tableExport({type: 'xml', escape: 'false'});"><img src='images/xml.png' width="24"/> XML</a>
    <a href="#" onClick ="$('#myTable').tableExport({type: 'sql'});"><img src='images/sql.png' width="24"/> SQL</a>
    <a href="#" onClick ="$('#myTable').tableExport({type: 'csv', escape: 'false'});"><img src='images/csv.png' width="24"/> CSV</a>
    <a href="#" onClick ="$('#myTable').tableExport({type: 'txt', escape: 'false'});"><img src='images/txt.png' width="24"/> TXT</a>
    <a href="#" onClick ="$('#myTable').tableExport({type: 'excel', escape: 'false'});"><img src='images/xls.png' width="24"/> XLS</a>
    <a href="#" onClick ="$('#myTable').tableExport({type: 'doc', escape: 'false'});"><img src='images/word.png' width="24"/> Word</a>
    <a href="#" onClick ="$('#myTable').tableExport({type: 'powerpoint', escape: 'false'});"><img src='images/ppt.png' width="24"/> PowerPoint</a>
    <a href="#" onClick ="$('#myTable').tableExport({type: 'png', escape: 'false'});"><img src='images/png.png' width="24"/> PNG</a>
    <a href="#" onClick ="$('#myTable').tableExport({type: 'pdf', escape: 'false'});"><img src='images/pdf.png' width="24"/> PDF</a>
    <table id="myTable" class="table table-striped">  
    <td>United Kingdom</td>  
  • tangerinetangerine Posts: 2,084Questions: 14Answers: 230

    You should take this up with the author of the example you linked to,
    tableExport.js is not provided by DataTables, which has its own "Buttons" module to handle exports.

  • jkathirjkathir Posts: 18Questions: 5Answers: 0

    The author's email is not known. any suggestions on what might be the issue can be useful and will try to resolve it and post if solved..just need suggestions or comments based on the experience...

  • tangerinetangerine Posts: 2,084Questions: 14Answers: 230

    The example page has a "Contact" link.

  • jkathirjkathir Posts: 18Questions: 5Answers: 0

    I have contacted the link and will wait for the response. Meanwhile, do you have any suggestions or comments to resolve them?

  • jkathirjkathir Posts: 18Questions: 5Answers: 0

    Several scripts caused this issue. We can close this.

Sign In or Register to comment.