0

This Meteor client code shows the parameters Param when it opens the destination link in a new tab. How can it be done so the values in param are hidden from the url and not displayed? Thanks

let windowRef = null;
let url = 'http://www.someurl/?';
let Param = {key1:val1,...}
Object.entries(Param).forEach(([key, value]) => url += key + '=' + value + '&');
windowRef = window.open(url.slice(0, -1), "myWindow");

edit
windowRef.history.pushState("Removing query", "Title", "/"); did not remove the Param values from the url in the newly opened tab.

Fred J.
  • 5,759
  • 10
  • 57
  • 106
  • `windowRef.history.pushState("Removing query", "Title", "/");` should work. It works with `window.history.pushState("Removing query", "Title", "/");` on this page for example. – Travis J Sep 11 '17 at 22:58
  • That did not do it. Please see edit. – Fred J. Sep 11 '17 at 23:28
  • Ah, yes, I originally thought this would be a CORS issue, and it turns out that pushState does qualify for that as well. Unfortunately, it appears that you cannot pushState across separate domains as the url parameter is relative to the execution of the script. I will reopen this, but to be honest, I think the answer here is that it isn't possible. – Travis J Sep 12 '17 at 20:29

1 Answers1

0
  1. You can try with redirect to new url with no parameter.

When user hit the url you can save this query params in local storage or sessions. Then you can simply redirect with no parameter.

  1. There's a script by the guys at Wistia that may do what you're looking for: Link
Pankaj Jatav
  • 2,158
  • 2
  • 14
  • 22