Two customers gave two pieces of code:
First paragraph:
<script id='_bdhm_mkt_2d221'>
(function() {
var mkt = document.createElement('script');
mkt.src = '//click.hm. baidu.com/mkt.js?2d221';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(mkt, s);
})() ;
</script>
Second paragraph:
<script src="https://ajax.googleapis.com/a...
How to package it into a new js? That is, a js contains the above two pieces of code?
仅有的幸福2017-07-05 11:08:36
Open Notepad and paste in the first piece of code.
Open Google’s JS code link, copy and paste the entire content into Notepad after the first piece of code.
Save the new file as a new JS, link to the page, Done!
Of course, you cannot do this when the content of the second script changes dynamically.
If you think it’s low, you can look at Gulp or Webpack.