This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

result page

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #39466
    YUANFANYUANFAN
    Participant

    How to make the result page appear in the iframe instead of jumping?
    I can’t find the code location.

    • This topic was modified 3 years, 8 months ago by YUANFANYUANFAN.
    #39479
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    I am not sure if this is possible at all. The form had to be submitted to the iframe, but the iframe source also has to be the original page.
    I don’t think this is easily possible without maybe editing the core plugin files.

    #39489
    YUANFANYUANFAN
    Participant

    I uploaded a picture
    My iframe is just below the search and I want the result page to appear in the iframe

    The settings of the plugin Results Behaviour cannot be implemented, there is only an option to open a new window.

    Because I’m not good at coding and don’t know where to start.

    #39512
    YUANFANYUANFAN
    Participant

    How to code the way to open the jump result page?
    I don’t see _blank, where else can I modify it?

    #39513
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Please note that custom coding is not actually part of our support. I will try to answer your questions, but I can’t promise anything regarding custom code.

    The redirection to the results page (when assigned to a new window) is handled by a function. Maybe if you try to override that, it may actually work:

    add_action('wp_footer', 'asp_add_footer_script_2', 9999);
    function asp_add_footer_script_2() {
    	?>
    	<script>
    	(function($){
    		WPD.ajaxsearchpro.helpers.openInNewTab = function(url) {
                      Object.assign(document.createElement('a'), { target: 'iframe1', href: url}).click();
                    }
    	}(WPD.dom))
    	</script>
    	<?php
    }

    For this you also have to change the redirection to a new tab: https://i.imgur.com/KrUwaGP.png

    However this may not work at all.

    #42156
    YUANFANYUANFAN
    Participant

    Your code solved my problem. But after I updated ajax search pro version 4.26.2, the code became invalid. What causes it?

    #42164
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Check if your frame name has not been changed, in the code it’s “iframe1”. There was no change in the scripts for the most recent releases, so this should still work just fine.

    Also, you can try a different variation:

    add_action('wp_footer', 'asp_add_footer_script_2', 9999);
    function asp_add_footer_script_2() {
    	?>
    	<script>
    setTimeout(function(){
    		WPD.ajaxsearchpro.helpers.openInNewTab = function(url) {
                      Object.assign(document.createElement('a'), { target: 'iframe1', href: url}).click();
                    }
    }, 2000);
    	</script>
    	<?php
    }
Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘result page’ is closed to new replies.