Keep a POST variable in a URL

0

I'm making an application in an online system that does not require programming knowledge (just for me) and one of the options you have to create a content is a plugin called Mobile , where you can paste the address of any web page to be displayed within the application.

The following is the code generated by that Mobile plugin:

<!DOCTYPE html>
<html>
    <head>
        <title>BlankTemplate7771</title>
        <script type="text/javascript">
        window.onload = function()
        {
            var url, hdiv = document.getElementById("hiddendivid");

            if (hdiv != null)
                url = hdiv.innerText || hdiv.textContent;

            if (url)
            {
                if (top == self)
                    window.location = url;
                else
                    top.updateWindowWithContentsOfUrl(self, url);
            }
        }
        </script>
    </head>
    <body>
        <div id="hiddendivid" style="display:none">http://devocionmusical.com</div>
    </body>
</html>

As you can see, the web address I gave him is link

What I want to know is, if I can add this " / fromMyApp = true " to the end of the route.

Maybe they suggest that I manually add that variable to the url, but the problem is that if the user goes to another section of the web devotionalmusical.com, then that variable disappears.

Is there a way to make / fromMyApp = true always be maintained even if the user goes to another section of the web?

I see that it uses JavaScript at the beginning, so my question is whether or not it can be done with that language.

    
asked by Josue Rodriguez 15.03.2017 в 14:56
source

2 answers

1

If you want to store a variable during the section you can use window.localStorage or window.sessionStorage and do not add them to the url path, they are easy to define and work with them. they work like a dictionary and you can store complete structures in JSON format they only have the limitation of 10Mb of maximum size but anyway you have size to spare. And the extra to keep urls clean.

window.sessionStorage.setItem('fromMyApp', true);
let valor = window.sessionStorage.getItem('fromMyApp')

The only difference between sectionStorage and localStorage, is that the first data disappear when you close the browser, while the second persist until you call .clear() or delete the navigation data.

Greetings

    
answered by 11.04.2017 в 19:58
0

According to what I understand, to keep the URL is to place, after the URL, the symbol "?"

It would look like this:

"http://devocionmusical.com?fromMyApp=true"

But if you browse within the iframe you will not be able to modify the links.

    
answered by 15.03.2017 в 16:17