Skip to content

Working ok with embedded JS but not with separate JS #109

@mako34

Description

@mako34

I have a test app with react-native-static-server rendering a local HTML file

for using JS, it works if I have the JS embedded in the HTML, but if I call it on a separate JS file it won't work...

in my App.tsx:

<WebView source={{uri:${origin}/${file}}} style={styles.webview} />
here is the embedded HTML:

<button type="button" onclick="alabama();">Play</button>
<button type="button" onclick="alert('Hello alabama')">music</button>
<script src="./chusa.js"></script>

chusa.js:

function alabama() {
  alert('Hello alabama');
}

So, alert works, the function doesn't.

How can I call the script on a separate file?

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions