Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rohan 105 posts 162 karma points
    Apr 20, 2015 @ 15:52
    Rohan
    0

    how to persist URL on browser ?

    HI

    I am workgn on Umbraco 7.2x

    I have one controller and inside it i have 'ActionResult' which call one of my Umbraco page.

    I can access that Action via browser by passing query string like below 

    "<mysite>/search/searchterms"

    It's working fine. 

    The main issue is that i need to persist the query strign in URL. Right now once the page is load , the query string disappear from browser.. so it is looking like "<mysite>/search/".

    I want to keep <searchtermss> as well in URL once page loaded.

    Can anyone please help me ?

    thanks in advance !

    rohan

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Apr 20, 2015 @ 16:05
    Dennis Aaen
    0

    Hi Rohan,

    On the form for your search field did you use GET or POST in the method, to get the querystring in to the url you need to use GET.

    Here is an example that I use, in the project I am using the ezSeach package https://our.umbraco.org/projects/website-utilities/ezsearch

    <form id="search-wrap" class="hide-phone search-wrap" method="get" action="@rootNode.Children(x => x.DocumentTypeAlias == "Searchresults").First().Url()">
        <label for=" search-input" id="search-button" class="search-button">
            <span class="visuallyhidden">Search</span>
        </label>
        <input id="search-input" class="search-input" name="q" type="text" value="" placeholder="@Model.Umbraco.GetDictionaryValue("[aller-aqua] Search")" autocomplete="off" />
    </form>

    Hope this helps,

    /Dennis

  • Rohan 105 posts 162 karma points
    Apr 20, 2015 @ 16:22
    Rohan
    0

    Hi Dennis

    thanks for the replay.

    My situation is that i have serachbox on my Master page . So once i enter keywords and press Enter, it will call my action/ adn redirct on '/search/' page from SurfaceController using "RedirectToumbracoPage()" method and shows all the result.

    So URL like <mystename>/search/

    What i want is i need to append that keywords what user has entered into the URL as well. <mysitename>/search/keywords ?

    Also if user directly enter <mystename>/serach/keywords then also it needs to execute the request and pull the result.

    So how to achieve this in Umbraco with MVC ?

    thanks

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Apr 20, 2015 @ 16:29
Please Sign in or register to post replies

Write your reply to:

Draft