javascript - Strip off the path of the href after the file is loaded into the browser -
when load web page , view source, can see
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.min.css"/>
if type in www.example.com/css/bootstrap/bootstrap.min.css
in address bar of browser, can see whole css file.
is there way can strip off path of href after file loaded browser, css/bootstrap/bootstrap.min.css
becomes bootstrap.min.css
?
any appreciated.
thanks
is there way can strip off path of href after file loaded browser,
css/bootstrap/bootstrap.min.css
becomesbootstrap.min.css
?
no. browsers implement "view source" re-requesting page server (which may or may not come cache) , showing text, exactly; don't have opportunity run client-side code remove link
or style
elements (and have client-side code, because naturally can't server-side , still have page render correctly normal requests).
even if run client-side code before "view source" shown, can't css anyway: altering or removing link
element remove stylesheet associated it. if (guessing @ reason this), wouldn't prevent being able see css trivial amount of effort.
you similar javascript on page (you can remove script
tag entirely once it's been run, won't affect code loaded), not css, , prevents people seeing script elements in debugging tools, not "view source."
any pointers on removing javascript tags...
sure, you're using jquery, it's simple putting:
$("script").remove();
...in code runs after other script code has run. here's example:
$(".dp").datepicker(); $("script").remove();
<link href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.min.css" rel="stylesheet"/> <script src="https://code.jquery.com/jquery-1.11.0.min.js"></script> <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script> <label> pick date: <input type="text" class="dp"> </label>
note jquery ui datepicker keeps working, though removed jquery , jquery ui script
elements dom. again, they'd still there in "view source," because above client-side code.
Comments
Post a Comment