Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
Create a link converter script that will change the entire URL on Ahref element into safelink URL 1. Create a folder that will be installed Safelink script with name “blog“. This “blog” folder contains an example HTML page with several links to other sites using the Ahref element. 2. create a file index.php in the folder “blog“. 3. Copy and paste the following code in index.php 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 <!DOCTYPE html> <html> <head> <title></title> </head> <body> <div> <a href="http://alexa.com">link1</a> <a href="http://koplojozz.com">link2</a> <a href="https://seegatesite.com">link3</a> </div> <script src="https://code.jquery.com/jquery-2.2.4.min.js" ></script> <script type="text/javascript"> var restricted_link = ["seegatesite.com"]; $('a').each(function() { $(this).attr("href", function(index, old) { var baseurlarray = old.split( '/' ); host = baseurlarray[2]; if(jQuery.inArray(host, restricted_link) == -1) { var base64 = window.btoa(old); return old.replace(old, "http://localhost/bypass/index.php?go="+base64); } }); }); </script> </body> </html>
2nd Oct 2017, 11:16 AM
Kushagra Pankajrai Bothra
Kushagra Pankajrai Bothra - avatar