Click here to Skip to main content
15,902,634 members

Comments by Bill Mayheptad Ritchie (Top 10 by date)

Bill Mayheptad Ritchie 12-Feb-20 12:07pm View    
Thank you very much @Richard Deeming, believe me you are God sent.
after removing the rel="noopener noreferrer" from the anchor tag, then the code work. I finally get the content of the anchor tag displayed inside the div tag on my download page. Thank you very much.
If not for your explanation, I never knew that the purpose of that rel="noopener noreferrer" is to stop the content from being accessed on another page.

But I still don't understand why Wordpress automatically inserted rel="noopener noreferrer" to any anchor tag with target="_blank" attribute.

Even if you remove the rel="noopener noreferrer" from the anchor tag once u set the target attribute to _blank and u update the page it will be inserted back automatically.

is there anyway to stop such behaviour
Bill Mayheptad Ritchie 12-Feb-20 10:17am View    
thanks you @Richard Deeming, I was just trying to implement the features I found on thewpclub.net and https://www.neesrom.com.
when u click on a download link on any of these sites' blog posts, it will redirect you to a page thesite.com/download and then on the download page, it will display a countdown timer of around 10 seconds and then display the download link button.
so that is why I was trying to get the anchor tag with the id="download" from the referring page to the download page.
so that I can now figure out how to change the src attribute to whatever the file a user want to download is.

please if u have a better and reasonable approach to solve this problem, please assist me.

Bill Mayheptad Ritchie 12-Feb-20 7:55am View    
Thank you once again @Richard Deeming.
the referring page is not created using javascript, it is a normal HTML tag

below is the part of the content on the referring page that I want to load into a div on the download page
<a id="download" class="download-wait" href="https://howtechwork.com/downloadfiles/" target="_blank" rel="noopener noreferrer"><img class="aligncenter" src="https://howtechwork.com/wp-content/uploads/2019/11/download-previous-or-older-version.jpg" /></a>

And below is the script on the download page
Hide   Copy Code
<div id="div1"> </div><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script><script type="text/javascript">var pageReferrer = document.referrer;$("#div1").load(pageReferrer + " #download", function(responseTxt, statusTxt, xhr){    if(statusTxt == "success")var loadedContent = document.getElementById("div1").firstChild;      console.log("External content loaded successfully! " + loadedContent);    if(statusTxt == "error")      alert("Error: " + xhr.status + ": " + xhr.statusText);  });</script>


despite that, I append the #download to the page referrer it's still not loading the anchor tag from the referring page to the download page.

I even tried to grab and log the image which is the first child of the anchor tag into the console to see if the .load method actually grabs the anchor tag with the Id=" download". But it displays Null in the console.

see the console content below

(index):735 External content loaded successfully! null

please what am I doing wrong?
Bill Mayheptad Ritchie 12-Feb-20 5:42am View    
thanks, @Richard Deeming, with the various debugging technique I have run so far.
I think the jquery .load function is loading the entire document of the referring page into the div. which is causing duplicate content in the console.

please if u no a better solution to my problem pls provide

all I was just trying to do is to send all the download links on each of my blog posts to howtechwork.com/downloadfiles then display the download link there.

just like thewpclub.net and https://www.neesrom.com did it on their blog.

please assist me
Bill Mayheptad Ritchie 11-Feb-20 13:49pm View    
thanks for your response @richard deeming.
there is no error in the console.
and the countdown timer on the download page work just fine.
but still, the jquery .load method did not seem to load the element with id="download" from the referring page into the selected div

but after removing the #download from the .load method, I only provide the pageReferrer variable, it loads the content into the div but the page appears like its auto-reloading the content.

look at the source code on the page https://howtechwork.com/downloadfiles/
<h2><span style="font-family: "comic sans ms", sans-serif">Please wait ! Your download will begin in <span id="countdowntimer">10 </span> Seconds.......</span></h2>

<div id="div1"></div>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script><script type="text/javascript">var pageReferrer = document.referrer;var timeleft = 10;var downloadTimer = setInterval(function(){timeleft--;document.getElementById("countdowntimer").textContent = timeleft;if(timeleft <= 0)clearInterval(downloadTimer);},1000);    $("#div1").load(pageReferrer);</script>