Discussions

Expand all | Collapse all

New Window instead of new tab

  • 1.  New Window instead of new tab

    Posted 03-24-2017 18:39
    So I have a formula URL that has the option ticked for "open in new window"...and this does sort of work---it's a limitation of my BROWSER settings that it chooses new windows to open in new TABS. And while that is normally the behavior I prefer (in general), I would like to make my "click to track" button actually open in a new window regardless of my browser settings.
    I assume this is a javascript thing, but since I don't KNOW javascript, I'm hoping one of you out there in Qbase land smarter than I can help me?


  • 2.  RE: New Window instead of new tab

    Bronze
    Contributor
    Posted 03-24-2017 21:10
    Hi Stephen, I've done this a few times, usually in formula text fields. The basic idea is that you need a little bit of javascript ahead of the url, something like: onclick=\"var a=window.open('"&[url goes here], 'newwindow', 'width=600,height=200');

    Where the width and height control the size of the window, however you can probably remove that or add a full size modifier. 

    If you need assistance making this work, feel free to reach out to me via the info in my profile and my team can help you further. 

    Good luck! 


  • 3.  RE: New Window instead of new tab

    Posted 03-29-2017 19:10
    onclick=\"var a=window.open('"&[url goes here], 'newwindow', 'width=600,height=200'); 
    Gives a warning that it needs a parenthesis after onclick..I was using a formula URL (not formula text) so I just must have my syntax wrong?


  • 4.  RE: New Window instead of new tab

    Top
    Contributor
    Posted 03-30-2017 04:26
    I think Eric was providing you with an example to show you the proof of concept.

    You will need it to be a formula-text field and the portion that contains the action when clicked will be:

    "<a class='Vibrant Success' onclick=\"var a=window.open('https://www.google.com/', 'newwindow', 'width=600,height=600');\" >Google</a>"

    This one is tested and works.


  • 5.  RE: New Window instead of new tab

    Posted 03-30-2017 12:29
    Matthew, (and Eric) yes, thanks! I'm completely uneducated on Javascript and even when I look things up on the 'net I find that I'm struggling with syntax. Thank you for helping me apply what eric did to the field. Is there some sort of resource regarding syntax for basic stuff like this you might suggest to help newer-users like me who have some programming knowledge (enough to be dangerous) but are unfamiliar with syntax and other applications of the details? 
    I am doing some online javascript tutorials to learn the basics but still hope to find a reference on how to apply them specifically to quickbase.


  • 6.  RE: New Window instead of new tab

    Top
    Contributor
    Posted 03-30-2017 14:52
    There are 100 of script examples in this application that were created in answer to questions or as part of a demo:

    Pastie Database
    https://haversineconsulting.quickbase...

    Most of the scripts have placeholders or parameters for dbid's and application tokens while fids and other data are typically hardcoded in the script. Generally you can modify these variables to match you values and keep the rest of the script unchanged. To get script to work in QuickBase you have to do some advanced things (like place all your code within a closure) but luckily the advanced parts are boilerplate that does not need to be changed. I would encourage you to learn JavaScript but I would work from an existing script as there are some best practices used to make the script work well within QuickBase.