javascript - Load all <script> tags from a different page -


i'm hooking separate page (same domain) , pulling current page using $.load, fine, if doing whole page, i'm not, i'm doing javascript code in page. wondering if it's possible load script tags said page current page?

i'm using below code:

var newmessageurl = $('#lnkcompose a').attr('href'); $('#hiddenscriptload').load(newmessageurl);

is said page on same domain or have access it? run trouble cross domain origin policy otherwise. if have access, way parse html using regex statement or html parser , pull scripts manually. sounds hacky approach though , i'm not sure why you'd want this.

if have access, page contents , use below script tag sources.

text.match( /<script src="scripts\/(.*?)\.scripts\.js"><\/script>/g ) 

credit javascript regex src url between script tag


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -