How to enable the right-click (with the new tab option) on an input or button

1

I have input that I would like to right-click to see the abrir link em uma nova guia option.

How can I do this, is it only possible with css and html , taking into consideration that this same button will fire a submit ?

    
asked by anonymous 09.01.2017 / 17:52

1 answer

0

With javascript I made a bunch of beast just from zoeira ...

<script>
    function detectLeftButton(evt) {
        evt = evt || window.event;
        var button = evt.which || evt.button;
        if(button == 1) {
            // ação para o botão esquerdo
			
        } else if(button == 2) {
            // ação para a rodinha do mouse
        } else if(button == 3) {
            // ação para o botão direito
			
			document.getElementById("menu").style.display='block';
			
        }
    }

    window.onmousedown = detectLeftButton;
</script>

<a href="http://www.google.com">Google</a>
<div id="menu" style="position:relative; top:-20px; left:-2px; display:none">
	<form action="http://www.google.com" method="post">
		<input type="submit" value="Abrir em nova aba">
	</form>
</div>

But I think this tooltip here with pure CSS is close to what you want:

Is it possible to make a tooltip with pure CSS?

With javascript, you have made here a much closer part of what you need than this budega I did above:

How to create a custom context menu?

But it still does not control the opening of a new tab.

    
09.01.2017 / 21:34