1

I tried to retrieve the blogger feeds code without using <script src = I tried document.write but when import is done the original page content is deleted Is there a way to import when pressing a button without using <script

<button onclick="myFunction()">Click me</button>
<h1>Test Content</h1>

<script>
function myFunction() {
// The problem here is deleting the text content With document
// And I tried Use document.createElement
// Is there any other way to call and run the file codes ?

 document.open();
document.write('<script type="text/javascript" src="https://photoshop4all.com/feeds/posts/default?max-results=5&alt=json-in-script&callback=URLAGAIN"><\/script>');

document.close();



  }



  function URLAGAIN(json) {


  document.write(json.feed.entry[0].link[1].href);




    }
</script>

1 Answer 1

1

see : https://www.w3schools.com/JSREF/met_doc_open.asp

The open() method opens an output stream to collect the output from any document.write() or document.writeln() methods.

Once all the writes are performed, the document.close() method causes any output written to the output stream to be displayed.

Note: If a document already exists in the target, it will be cleared.

Note: Do not confuse this method with the window.open() method, which opens a new browser window.

you can see here how to insert script whith js

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.