How can I get the current page format? I mean, if im in
abc.com/index.html
How could I get that the page is on index.html instead for example index.jsx / index.php?
I could try to split the URL after the '.', but if the link is on the index it wont show.
Any help would be appreciated.
You can't.
If you ask the server for the resource at / then you get the resource at /.
The server won't tell you if it generated it from a file called index.html or index.php or default.php or some logic internal to the server which doesn't involve loading a specific file at all.
Related
I would like to know, is there a way to edit a Javascript file or a specific page, on any website, and refresh this page and show my changes?
For example, there is a website: http://example.com.
Many files are requested including a Javascript file:
http://example.com/assets/app.js
Can I modify this app.js file, and show my modifications when updating the page or is this not possible?
For example, save the file my cache? Or something like that?
and Thanks.
Normally speaking, you can't directly modify the files like assets/app.js, etc, since they are stored and read from the backend server of http://example.com.
However, you can still make custom changes to some specific pages/websites by scripts/styles injecting.
I think you might be interested in some browser plugins/scripts like:
Tampermonkey: https://www.tampermonkey.net/, Greasyfork: https://greasyfork.org/en, Stylish: https://userstyles.org and so on ... :)
i have some strange question. i know when i visit any folder of site and in that folder if we have index.php then the xyz.com/folder_name will display contents of that folder if index.php file is there.
i just came across one site here
https://santabanta.pushpaddy.com/
when u will load u can see in network tab that they are loading several links as usual but i did not understand this particular link. how this link is being processed.
https://santabanta.pushpaddy.com/check/emj_F9FghmI:APA91bHsomenoandtextHn2qOPwvs-Jti-pAR1vYDsomenoandtextx2lWwyyYP-Ez1kQsomenoandtextl94nQdmOZEOGYVnA-cVhum6YrN0ZFLUIqu-PmGXMecysomenoandtextc9vvmuyxQ
after check you can see that its generated dynamically and how the server will process these data??
defenitely nothing is there in index.php under check folder. so how it is working. if you will open that link directly it will give that 404 error but when i reload that page
https://santabanta.pushpaddy.com/
it fetches content from check link with 200 code means all are fine.
i know it looks like silly question but i really want to learn this part
As per my understanding this is a token(Like JWT) directly attache to url so that if you open url the server side code will read token and convert the token from encrypted to decrypted and use this information to perform further logic.
I'm trying to retrieve the ID of an employee and show them in my details page by retrieving the Employee ID from the URL using Page Mapping in ASP.NET:
RouteTable.Routes.MapPageRoute("", "employee/{id}", "~/details.aspx");
Such that the URL will be:
www.myexamplewebsite.com/employee/7937822353
The problem is, the Javascript files don't get loaded and the console is full of my javascript errors. I get a 404 error in my JS scrips as well. The page can't find any JS file when mapped. Why is this happening when I map the URL? This does not happen if the URL is www.myexamplewebsite.com/7937822353.
What am I doing wrong?
EDIT:
This is how my JS files are referenced:
<script src="js/chatbar/rightside.js"> </script>
The script is relative, and it's from the perspective of the client side URL. So when you change the page route to have the page appear to be served from a /employee subdirectory, the correct relative path to your scripts changes. So it's looking for the scripts at /employee/js/charbar/rightside.js. You could change those relative paths (to something like ../js/chartbar/rightside.js), but you might run into a problem later if you change the routing again.
So instead, it's best to make the reference application root relative.
<script src='<%= ResolveClientUrl("~/js/chatbar/rightside.js")%>'></script>
I am building my first J2EE application using J2EE 7 and JDK 7. I have a JSP that says:
script type="text/javascript" src="${pageContext.request.contextPath}/appName/javascript/MyScript.js">close-tag
If I use the (welcome-file) tag in the web.xml then it loads the page and the JavaScript file. I can see the alert it prints and in firebug under "Net" it shows that it downloads the 226 bytes. If, however, I use a servlet to determine the page it needs to open and use response.sendRedirect() or RequestDispatcher.forward() then firebug has status "200 OK", but it does not download the JavaScript file. It says "0 bytes".
So, basically, if I use the servlet to redirect to pages that import JavaScript files from webapps (tomcat) it does not find them. If I use the web.xml to determine the URL I want and open that in firefox, it finds them.
Can anyone help please?
Thank you
What's your servlet's context path? If it's the default (root) one, the ${pageContext.request.contextPath} will return empty string and the URL in the src attribute will not start with / resulting in relative URL. This may be the reason why the javascript is loaded only from your welcome page and not from your forwarding or redirecting servlet. Open the HTML source code of your page and look, how was the <javascript> tag and the src attribute rendered.
I'm using the default index.html located in RessourcesFolder of my app. The index.html page is only there to check if my application has an update (new html pages to display in app).
It works perfectly.. I can download my new contents from the server in applicationDataDirectory
But.. when I finished the application update, I'd like to replace the current index.html page with my updateindex.html
Loading remote html pages works fine, for example:
currentWindow.setURL('http://www.stackoverflow.com/' );
However, when I try something like
currentWindow.setURL('C:\Documents and Settings\myuser\Application Data\TideSDK\testApp\index_update.html' );
Nothing is appended..
Can anyone help me?
you can modify the path of which index page you want to load within your application
this can be modified within the tiapp.xml file. Replace "app://index.html" with "app://updateindex.html" and you should be good to go