Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Hi Benny,

Not sure I understand..
You can add the JavaScript code on Page Load event (fires once for start screen / each time you open the page for other pages).

Benny Halperin
Posts: 0
Joined: Wed Oct 02, 2013 8:13 am

I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Hi Katya,

When I code outside of Appery (e.g. Visual Studio) and write my own HTML files, I am free to add code<script src="&#46;&#46;&#46;">/code tags as I wish in each page.

When I create a javascript file (say myscript.js) in Appery, Appery automatically adds a code<script src="myscript&#46;js">/code to each page.

I want to be free to decide which page references the javascript. I hope my question is clear now.

Thanks, Benny

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Hi Benny,

There is no way to choose pages to add custom code in Appery.io.

Here is the solution:
Describe all of your code in functions which is called on Load event (or any other event) for those pages in which this code is needed. Or, before exporting the project you can delete lines with the script on pages where it is not needed.

Benny Halperin
Posts: 0
Joined: Wed Oct 02, 2013 8:13 am

I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Hi Katya,

Thanks. I think Appery should support choosing the pages I wish the js to be referenced. I don't see a reason not to. But I understand that this is the case now. How can I make this a suggestion?

So, if I add custom script that runs on events (in the events panel), where can I see my custom event handling code? I mean which source file includes this code?

Benny

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Hi Benny,

You can do this in JavaScript file of page where you add an event.
For example, this is startScreen.js for startScreen.

Benny Halperin
Posts: 0
Joined: Wed Oct 02, 2013 8:13 am

I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Hi Katya,

I looked in this file (under Source/Web Resources) but found no trace of my code.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

I create my own javascript but wish this javascript file to be referenced by one page only, and not by all of the pages.

Hi Benny,

Source code is changed only when you export or preview the application, that is to apply them you must click the "Test" button.
If this doesn't help - most likely you changed the page source before creating custom JavaScript. Please roll back the changes (http://docs.appery.io/tutorials/sourc...), and then the code appears.

Return to “Issues”