Download a page only with the link? [duplicate] - javascript

This question already has answers here:
How to download a file with Node.js (without using third-party libraries)?
(31 answers)
Closed last month.
I want to know is there any way to download a page only with the link.
For example : link and at the end we got the source code.
Here is my pseudo code :
/* 1- create a variable and save the link of the current page in it 2- download the saved link source code in a HTML file */

Use the HTML download attribute e.g. <a href="/images/myw3schoolsimage.jpg" download>

Related

How to display a html source code saved inside a <code></code> tag of external / shared location page in my local html page? [duplicate]

This question already has answers here:
Get text from body tag of another page hosted on another domain - javascript / Jquery
(4 answers)
Get HTML content from another site
(1 answer)
Closed 1 year ago.
I have a shared external HTML file, inside that html file : a full html source code has written inside a <code> tag. Please help me to read that html source code inside the <code></code> tag and display it in another html file which i need to save in my system locally.
there will be changes in html source code inside the <code> tag, so without referring there i need to load the html source code in my page load, automatically.
how can i make it possible

How to hide my javascript but let other download my webpage with thr script without them knowing? [duplicate]

This question already has answers here:
Can we hide javascript loading from the user?
(2 answers)
Closed 4 years ago.
So this is how it goes... I wanted to create a javascript that redirects links to my URL. So if anyone copies my webpage, they try changing my links, when they upload it to their server, her links will still redirect to my links. Is this possible with js? Or if I use PHP to hide the location of my js. I want that js to still work in the webpage they copied and use. Like a sticky clickjacker. That's hard to find and remove. Or if possible they cant at all.
I wanted to create a javascript that redirects links to my url.
This means that the user would have to already be at your URL because the JavaScript to redirect to your URL can only be added to pages that you control.
So if anyone copies my webpage, they try changing my links, when they
upload it to their server, her links will still redirect to my links.
As soon as they make a copy of your code, it's their code and they can upload it anywhere they want without your knowledge. And, if they can change your links, they can also just remove any JavaScript you may have had in the file.
What you want to do is not possible.

Can i pull html content from a exterior file? [duplicate]

This question already has answers here:
jQuery.load to load HTML file
(2 answers)
Closed 5 years ago.
This might be a really stupid question... But i'm making a menu. Would it be possible to write the code for that menu in an outside source? and then pull it using Jquery or javascript and have it replaced in a location or something?
The menu would look like:
<span class="menulist">
<span id="homemenu">
<button id="home">Home</button<
</span>
<span id="onemenu">
<button id="one">Page One</button<
</span>
</span>
And have all that saved in a seperate file. I dn't care what type of file, .js, .txt, .html. and just pull the text and dump it as objects in a location specified for menu?
If this theoretically works here, I could use it elsewhere. such as writing the story narrative in one file and revealing it, or revealing it in part, and having the layout and technical workings on another file.
Take a look at jquery's load function.

Inserting part of webpage into another using html only [duplicate]

This question already has answers here:
Can an iframe only show a certain part of the page?
(8 answers)
Closed 8 years ago.
I am trying to build a webpage using wix.com, and I want to include part of another website into mine. I can add html code. I am trying to get the featured poet on poetryoutloud.org into mine. This changed everyday and I only want this part of the webpage. I know that if I wanted to include the whole webpage I could use an iframe element, but this is only part of it
You can use an iframe
or alternatively you can use ajax, here an example using jQuery.
$("#yoursite-html").load("yoursite-html.php");
Please note if content is on another domain as described in your answer (CORS issue), you have to use a simple proxy example below:
PHP in file "yoursite-html.php":
echo file_get_contents("http://www.yoursite.com/");

How do I make one download link with two things to download? [duplicate]

This question already has answers here:
Send multiple files to the user for download one after another
(2 answers)
Closed 8 years ago.
I know the normal download link is the a tag with the attribute of download and href, but that downloads only one thing. What if I want to make only one link for two things to download? Would there be 2 hrefs? Help please!
One way you could do is it have the anchor (link) tag call a javascript function.
Download
function Download() {
//javascript code to download first file - window.open("download link 1");
///javascript code to download second file - window.open("download link 2");
}

Categories