0

Using JSinjector, i included a jQuery and made use of a function. I wrote a query inorder to display the external link within a certain div section (within our site). My code goes here

 (function ($) {
       Drupal.behaviors.YOURTHEMENAME = {
              attach: function(context, settings) {
              $('.div-classname a').click(function(){
              var url = $(this).attr('href');
              var height = $('#div-id-name').height();
              var width = $('#div-id-name').width();
              $('#div-id-name').replaceWith( "'<object data="+url+" width="+width+" height="+height+"/>'" );
               return false;
             });
           }
         };
         })(jQuery);

In concise, the above query does the functionality - " whatever the hyperlinks within the div class (div-classname) when clicked the corresponding website opens within the div with id (as div-id-name). Previously, div-id-name region has a content but when the hyperlink is clicked, jquery executes now the content (within the div-id-name) is replaced with the corresponding site.

Everything goes well the query works..

But my problem here is after the content is replaced with the corresponding link, now when i press the back button - rather than loading the previous page or the website's home page it redirects to the browser's home page (i.e., either google.com or whatever).

What might be the problem? Is there any thing link configuration issues? or do I need to include any code (query)..

I m using Drupal 7

1 Answer 1

0

Disable the click function for the more links div.

$('.div-classname a').on('click',function(){.....});

$('.more-link a').off('click');

This is the perfect solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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