1

I have this java script. The purpose is to open a NEW tab on any outputlink field. The script works but it disables my other tabs. When I remove my Includescript the tabs work but any outputfield link I click it renders inside the same iframe.

<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" />

<script>
jQuery(document).ready(function() {
    jQuery('.openInPopup a').click(function(event) {
        event.preventDefault();
        window.open(jQuery(this).attr('href'));
    });
});    

Any advice? Thanks in advance. I know it has something to do with the value of the includescript. There can be another option?

1
  • 1
    Instead using jquery and function to open link in new tab. I suggest use html base tag <base target="_blank"/> just add this tag in vf page it will open all the links in new tag.. w3schools.com/tags/tag_base.asp
    – Ratan Paul
    Mar 23 '16 at 7:03
0

I think I had the same problem a couple years ago.

Try the following:

var $j = JQuery.noConflict();
$j(document).ready(function() {
    $j('.openInPopup a').click(function(event) {
        event.preventDefault();
        window.open($j(this).attr('href'));
    });
});

It could be a conflict issue with Salesforce Tab javascript functions.

Hopefully this solve your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.