How to stop redirected URL from being masked?

I have a doGet function in my google apps script (attached to a google doc) which is published as a web app and I want the user to be redirected to another web page. Importantly, I want the URL of the page they are redirected to be displayed in the address bar, and the title of the page they are redirected to be the title of the tab (in Chrome).

I've tried using a meta refresh tag, and setting the window.location.href. Both of these redirect correctly but they show the URL of the address app in the address bar, not the URL of the page the user is redirected to.

The below script, attached to a Google Doc, illustrates the problem.

function doGet(request) {
  var drive = DriveApp;
  var docs = DocumentApp;
  var Id = docs.getActiveDocument().getId();
  var document = docs.openById(drive.getFileById(Id).makeCopy().getId());
  document.setName("Test doc 2");
  var URL = document.getUrl();
  return HtmlService.createHtmlOutput('<meta http-equiv="refresh" content="0; url=' + URL + '" />')
}

Publishing the script as a web app and then visiting the URL redirects you to the newly created document, but it is the URL of the script that displays in the address bar.

See this Google Doc for an example: https://docs.google.com/document/d/1HpBkNGGGjKj3W6QXThtGdniSO_UTANo8LcqmgZowdTQ/edit


Since your html is loaded in a inner iframe, You should use

window.top.location = url

to load in the top frame.