open a hidden div by clicking on a link from another page

0

I will try to explain what I need, I have found some similar things but not the same and it does not work for me.

By clicking on a button or link I want you to open another .html page and show a hidden div of this.

example:

PAGINAPRINCIPAL.HTML

<div class="title">PARIS
<a id="detalhes" href="ofertas.html">DETALHES</a></div>

================================================================================================= =============

PAGINASECUNDARIA.HTML (PAGE WHERE DIV HIDDEN)

<link rel="stylesheet" href="css/HIDDEN.css">
#detalhes1, 
#detalhes2,
#detalhes3,
#detalhes4,
#detalhes5,
#detalhes6,
#detalhes7,
#detalhes8
{
    display: none;
}

<div class="block2" id="detalhes1" >
                        <img src="images/page2_img1.jpg" alt="" class="img_inner fleft">
                        <div class="extra_wrapper">
                            <div class="text1 col1"><a>Barcelona</a></div>
                            <p>Cras facilisis, nulla vel viverra auctor, leo gna sodales felis, quis malesuada nibh odio ut velit. Proin pharetra luctus diam, a celerisque eros convallis accumsan. </p>Maecenas vehicula egestas venenatis. Duis massa elit, auctor non pellentesque vel
                            <br>

                        </div>
                    </div>
                    <div class="block2" id="detalhes2" >
                        <img src="images/page2_img2.jpg" alt="" class="img_inner fleft">
                        <div class="extra_wrapper">
                            <div class="text1 col1"><a>Barcelona</a></div>
                            <p>Cras facilisis, nulla vel viverra auctor, leo gna sodales felis, quis malesuada nibh odio ut velit. Proin pharetra luctus diam, a celerisque eros convallis accumsan. </p>Maecenas vehicula egestas venenatis. Duis massa elit, auctor non pellentesque vel
                            <br>

                        </div>
                    </div>
                    <div class="block2" id="detalhes3" >
                        <img src="images/page2_img3.jpg" alt="" class="img_inner fleft">
<div class="extra_wrapper">
<div class="text1 col1"><a>Barcelona</a></div>
<p>Cras facilisis, nulla vel viverra auctor, leo gna sodales felis, quis malesuada nibh odio ut velit. Proin pharetra luctus diam, a celerisque eros convallis accumsan. </p>Maecenas vehicula egestas venenatis. Duis massa elit, auctor non pellentesque vel
                            <br>

                        </div>
    
asked by everson 12.11.2018 в 22:38
source

1 answer

0

Assuming the problem is that there is part of the new page that you only want to show when you reach it from a particular page (the first page of your example).

To solve it you can send a parameter to the server along with the request indicating which is the source page.

When the server receives the request it is fixed if the parameter comes, and if so, if it has the expected value.

If the value is the expected one, then either directly lower the html showing that part (the hidden part) of the document, or set a javascript variable in the document, so that once the page is loaded, using javascript the hidden part is shown .

The parameter can be sent as a query in a GET

http://www.example.com/paginadestino.html?orgien=mi_primera_pagina

Doing a POST of a form, placing the variable in a input hidden

<form method="POST" target="http://www.example.com/paginadestino.html">
  <input type="hidden" name="orgien" value="mi_primera_pagina"/>
  <input type"submit" name="enviar" value="Enviar"/>
</form>

If the page is from your same site, you could also set the parameter as a cookie. But it seems to me that it is more feasible to use one of the previous methods.

Note: It is worth saying that any information that is hidden in an HTML is just that, it is hidden but it is there for anyone who has the time and desire to look for it.

    
answered by 12.11.2018 в 23:26