Search code examples
htmltwitter-bootstraphttp-referersitemesh

how to know from where the page is loaded


Is there a reliable way to know from where my page is called? I know there is the referer string in header, but it's not reliable.

I'm building a page that contains some elements (like logo for example) that should be loaded if the page is called by the same context and not loaded if it's called by outside. I'm thinking to put a hidden attribute somewhere that could be used in any href of submit, but I don't know the better way to do it.

I'm using sitemesh and boostrap.


Solution

  • I could manage this using urlRewrite.

    I created a rule like this:

    <rule>
        <from>^/popup(.*)</from>
        <to>$1?popup=true</to>
    </rule>
    

    Whit this rule, I can call any url that I need using /popup before to change the layout I need.

    So, using the url http://www.mypage.com/mypage.jsp will show the page fully formated and using the url http://www.mypage.com/popup/mypage.jsp will show the page without logo (what I need).