简体   繁体   中英

Use javascript to fetch content from external site

Say I there's mypage.html and otherpage.html

otherpage.html has some content <p>content is content</p>

I want a javascript that can fetch the content from otherpage.html and paste it in mypage.html

Is there a javascript that can accomplish this? thanks.

From the title, it appears that otherpage.html is in a different domain. This being the case this is not possible in the browser (there's a few exceptions with flash/java/silverlight). If the page is in the same domain, it's easy. Take a look at jQuery.get .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM