SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    Paris
    Posts
    370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form, New Window/Tab, Target="_blank"

    Hello i have a little problem with the target attribute ine the form below...
    Code:
    <form id="formReport" action="<?php echo $reportlink;?>" method="post" target="_blank">
    		<input type="hidden" name="reportProject" value="1">
    		<input type="hidden" name="idProjectRevision" value="<?php echo $idProjetRevision; ?>">
    		<input type="hidden" name="generateButton" value="<?php echo $bouton_generate_report; ?>" >
    	</form>
    this form is submitted using the following .js code in order to generate a pdf

    Code:
    document.getElementById("formReport").submit();
    the problem is that i get a popup (blocked by firfox by the way) instead of a new window or a tab, how do i solve this?

    Regards
    On a PHP/Java/XML/Javascript/MySQL internship right now!

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is no way to open new tab instead of window. you can have an iframe as target.
    For examples see the page below:
    How to create a multi-submit form

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,815
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The idea is to let your visitors decide where new pages open. That's why the target attribute was deprecated in 1999 because of it taking away options from your visitors instead of adding them.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    Paris
    Posts
    370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i know that but in this particular case the clmient wasnt the pdf that is generated by the application to be opened in a tab or a window, it doesn't matter... i just doesn't want a popup blockied by Firefox... i open pdf generatyed by website or application all rthe time through ff or chrome and there is never a popup problem
    On a PHP/Java/XML/Javascript/MySQL internship right now!

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,815
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    To open a new tab or window without a popup block problem is must occur as a result of your visitor clicking a link. Anything that you generate that isn't from them clicking a link can be blocked by popup blockers.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •