How do I generate a glTF file and then include it in a link and open it in AR using Android Scene Viewer?

I am trying to generate a glTF file from a custom 3D glTF configurator I am building. The file is being generated and I can download it without a problem if I use link.href = URL.createObjectURL( blob ); and = filename; in the save(blob) function. However what I am trying to do is to first generate the glTF file and then concatenate it in the link.href so instead of just downloading the glTF file to be able to open it in AR using Google Scene Viewer on an Android mobile device. Unfortunately when I am calling the exportGLTF() function the browser crashes! Any ideas of what I am doing wrong?

Here is the code I am using:

  var link = document.createElement('a'); = 'none';

  function exportGLTF() {
    var gltfExporter = new GLTFExporter();

      function (result) {
        var output = JSON.stringify(result, null, 2);
        saveString(output, 'scene.gltf');

  function saveString(text, filename) {
    save(new Blob([text], { type: 'application/json' }), filename);

  function save(blob) {
    link.href =
      'intent://' + URL.createObjectURL(blob) + '&mode=ar_only#Intent;scheme=https;;action=android.intent.action.VIEW;end';;