Load URL with JavaScript

0

How can I load this web devocionmusical.com with JavaScript ?

I also want to add this at the end ? fromMyApp = true

Then, if the user navigates to another section of the web, eg: devocionmusical.com/songs that is also added to the end ? fromMyApp = true

Thank you very much!

UPDATE:

<!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>

UPDATE 2: Part of the code at devocionmusical.com

{if isset($_conf.jrAudio_block_download) && $_conf.jrAudio_block_download == 'off' && $item.profile_quota_id != 9}

{if isset($_post['fromMyApp'])}
<div class="add_to_cart_section" title="Free Download"><span class="add_to_cart_price">GRATIS APP</span><a href="external://{$jamroom_url}/{$murl}/download/audio_file/{$item._item_id}" title="download">{jrCore_icon icon="download" size="24"}</a></div>
{else}
<div class="add_to_cart_section" title="Free Download"><span class="add_to_cart_price">GRATIS</span><a href="      {$jamroom_url}/{$murl}/download/audio_file/{$item._item_id}" title="download">    {jrCore_icon icon="download" size="24"}</a></div>
{/if}

{else}

<div class="add_to_cart_section" title="Download Not Available"><span class="add_to_cart_price">N/A</span>{jrCore_icon icon="lock" size="24"}</div>

{/if}
    
asked by Josue Rodriguez 17.03.2017 в 16:34
source

1 answer

1

If you want to load the domain http://devocionmusical.com/ from a different domain with javascript, chances are you can not. Browsers forbid this, thanks to Access-Control-Allow-Origin unless that domain adds line Access-Control-Allow-Origin: <SITIO_WEB> within the server-side code.

However, with a bit of HTML you can use the iframe technique, as follows:

<iframe src="http://devocionmusical.com/?fromMyApp=true"></iframe>
<-- Es aquí en donde puedes agregar la variable que necesitas -->

If you are creating an Android application, a section in the same domain, or a Chrome extension, you can use the jQuery library for JavaScript.

In this case it consists of the following:

jQuery.get("http://devocionmusical.com/?fromMyApp=true", function(respuesta){
// respuesta = contiene los datos que envía el dominio.
});
    
answered by 19.03.2017 в 10:04