1

So everytime I click the href, there's a popup page which is add_form.php that will appear, and there's a form inside of it.

This is my code:

<a href="" onclick='return popup_link()'>Add</a>

<script type='text/javascript'>
        function popup_link(){
        var url = 'add_form.php'; 
        window.open(url,'win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=1076,height=768,directories=no,location=no'); 
        }
</script>

I just want to know, how to remove the URL of the current page inside the address bar where in this is the output every time I click the <href> link.

http://127.0.0.1/no%20page%20reload/add_form.php

The above URL points to localhost. I don't want to see the URL on that popup page. So that everytime I print the current page, there's no URL included or displayed on the printed page.

clemens
  • 16,716
  • 11
  • 50
  • 65
not_null
  • 111
  • 10
  • 1
    You can't in modern day browsers – epascarello Dec 06 '17 at 05:30
  • So there's no other options either? – not_null Dec 06 '17 at 05:32
  • Printing a page, that is a setting on the print set up to not include it or look into https://stackoverflow.com/questions/2573603/removing-page-title-and-date-when-printing-web-page-with-css – epascarello Dec 06 '17 at 05:33
  • Possible duplicate of [Can I remove the URL from my print css, so the web address doesn't print?](https://stackoverflow.com/questions/2192806/can-i-remove-the-url-from-my-print-css-so-the-web-address-doesnt-print) – lscmaro Dec 06 '17 at 05:38
  • I know right. But how if I just want to see the form only, not the URL? everytime the page appear. – not_null Dec 06 '17 at 05:38
  • @Iscmaro, all I want is to display the page with no URL. I just include printing the page, just for my example. – not_null Dec 06 '17 at 05:40
  • My question is all about, removing the URL on the page. not on printing the page. I just make it as an example. Thank you ;) – not_null Dec 06 '17 at 05:41
  • You should use AJAX to get the data from add_form.php. You can then use ajax to submit the form data and your URL will not change using AJAX. – Ahmad Gulzar Dec 06 '17 at 06:03
  • Hi @AhmadGulzar, actually I already tried that one. But my requirement is to open a popup page or new page with the form I created with no URL in it. Is it possible to disable the URL wherein it will be removed or will not display everytime the page with form displayed? – not_null Dec 06 '17 at 06:32
  • try this https://stackoverflow.com/questions/10774211/change-url-of-already-opened-popup – Ahmad Gulzar Dec 06 '17 at 06:43
  • But still, there's a link/URL right? The link http://www.canop.org will just be replaced by http://www.google.com. But still the URL is still there. :( – not_null Dec 06 '17 at 06:50

1 Answers1

1

To modify current URL you can use :

1.The pushState() if you want to add a new modified URL to history entries.

2.The replaceState() method if you want to update/replace current history entry

window.history.pushState({}, document.title, "/" + NewURL );
Hasan Haghniya
  • 2,347
  • 4
  • 19
  • 29