I have event coded to show the event on each page of the website. Is there a way to code it so that when you need to update it, you can do it once and it will show on each page? (vs having to update HTML text on each page).
Yes, create a external JavaScript(.js) file and include it on the each page. e.g
<script src="scriptfile.js"></script>
Whenever you want to update/change, just update the js file.
Definitely. You can set up a local server and then make .php files having html code in them. You can then include these .php files in your different html files as and when required. But for all this to work, local server configuration is required(like Apache and MySQL).
Related
I would like to make an input mask with javascript in Oracle Apex a bit prettier. How can I do that?
Is there any way I can upload and embed a .js file?
If so, how do you do it?
Can I style whole pages with js and then upload it?
I’m confused.
Thank you
Step 1 open Shared Components and upload your .js script into static application files
Step 2 Upload the js script into Static Application Files and copy the reference, this reference works exactly the same as an URL
Step 3 In shared components open User Interface Attributes
Step 4 Paste it into Javascript / File URLS
Your script .js will be available in all your app, also you can add .css files in Cascading Style Sheets option
You can upload files to use as application or workspace resources, but for most static files (images, js libraries, etc.) you will get much faster response if you serve them from a separate web server and just put the links in your APEX code. For example, if you are using Apache HTTP or nginx as a reverse proxy for APEX you can serve them from there.
Select a page.
Click Edit Attributes.
Scroll down to HTML Header.
Enter code into HTML Header and click Apply Changes.
For example, adding the following would test a function accessible from anywhere on the current page.
<script type="text/javascript">
function test(){
window.alert('This is a test.');
}
</script>
In Oracle Application Express you can reference a .js file in the page template. This approach makes all the JavaScript in that file accessible to the application. This is the most efficient approach since a .js file loads on the first page view of your application and is then cached by the browser.
The following demonstrates how to include a .js file in the header section of a page template. Note the line script src= that appears in bold.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>#TITLE#</title>
#HEAD#
<script src="http://myserver.myport/my_images/custom.js" type="text/javascript"></script>
</head>
<body #ONLOAD#>#FORM_OPEN#
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 am looking at the docs here:
https://developer.linkedin.com/plugins/share
and I have this:
the problem is that it's referencing a script file:
src="//platform.linkedin.com/in.js"
where/how do I get that script file? I need to include that script file in my project.
The script it in where you typed. platform.linkedin.com/in.js just remove the //. If you are wondering how to download it.
open the url platform.linkedin.com/in.js.
Right click on the code
Click on save page as
save where you want it
I have got a javascript file which is in core folder and I want to unset that file without editing the core. I haved added
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/lazy-images/assets/lazysizes-gh-pages/lazysizes.min.js|static';
in my template file. And this file got minimized and is present in assets folder. But the same file is present in head tag.
<script src="system/modules/lazy-images/assets/lazysizes-gh-pages/lazysizes.min.js" async></script>
I need to unset this file. How this can be done?
This JavaScript is added via the config.php of that extension. See https://github.com/derhaeuptling/contao-lazy-images/blob/2.0.1/config/config.php
To unset it, you would simply need to search for 'system/modules/lazy-images/assets/lazysizes-gh-pages/lazysizes.min.js|async' within $GLOBALS['TL_JAVASCRIPT'] within the config.php of your own extension (wich is loaded after the lazy-images extension) and unset that array key.
However, it's probably not wise to do that. You should not combine this script with the others.
I want to load an external file into my file. the external file present another server and my file present in another server.
If i use this $("#content").load("content.html"); that is works fine the the both file in same server but my files are having different server
Example:
my file present in my local server
inside index.html there is div having div id "content"
and menu.html file present in http://phpraddyx.com/
$(document).ready(function(){
$("#content").load("menu.html");
});
Load a local .php file into your container which itself is getting and returning the content if the external source (this course assumes that PHP is installed)
I think you can create a proxy page on you local server, e.g.
proxy.cgi?url='.....'
And use this server cgi page to fetch the url and return the content.
If this is only for designing, use iframe instead. (e.g. loading head menu links, etc.)
<iframe src="http://phpraddyx.com/" width="#" height="#">
Or since the code will work in the same server, save the Java file on that server and load it on HTML file stored in other server:
<script src="http://phpraddyx.com/menu.js"></script>