Javascript inject in Perspective... have fun

Soo i'll just link this here...
You can do whatever with it, but its not really gonna be clean or easy xD Have fun :man_mage:

WARNING
Dont let userinput enter in here

7 Likes

You magician! :magic_wand::mage:If I knew any JavaScript I would certainly try this out, haha, but this seems VERY cool! It would be cool if you could write it back to the view... :sweat_smile:

At first sight i found the page context and session context. But the page context isn't really the same as the view... There is a function findView(resourcePath: string, mountPath: string) in it though... So i bet you could find it... It would require a lot more javascript though, so probably not idea to try and code that inside a markdown string xD

Here ya go xd

1 Like

Gonna try to keep this topic updated with all my cool injectings :stuck_out_tongue:
Version 8.1.22 svg clicker :wink:

3 Likes

This seems like something geared more toward Ignition Exchange, as opposed to sporadic forum postings.

Let's say... keep it to one thread, instead of creating new ones.

3 Likes

I am surprised that the JS Injection hack would even be approved into the exchange! lol

1 Like

Shhhh! :shushing_face: :grimacing:
We might find this thread just...
disappear

3 Likes

WARNING
Dont let userinput enter in here

Edited the top for this too.

2 Likes

Have you tried to determine if the device running the perspective screen had geolocation functionality and if so were you able to get device location? With something like this: ```
function get_location() {
if (Modernizr.geolocation) {
navigator.geolocation.getCurrentPosition(show_map);
} else {
getCurrentPosition
}
}
Navigator.geolocation snippet:


For my use case I would not want a map, just longitude and latitude coordinates.  Would use them to confirm location, then check location against a variable set to confirm the user is in a location that will allow certain on page functionality to become accessible. Purpose is to write a perspective screen to handle hourly employees clock in / out, but only allow if user is on site or within a certain range of the facility they were clocking into. Would need to get the long and lat values to run a comparison. Link above suggests:  ```
function show_map(position) {
  var latitude = position.coords.latitude;
  var longitude = position.coords.longitude;
}

session settings have geolocation already
https://docs.inductiveautomation.com/display/DOC81/Session+Properties

Anyways this seems weird to use it for checkins...
Dont you need to be on the company ip addres already to enter perspective xd (be in wifi range)
Or are you hosting it online?
In which case this is not very secure

Victor,

Thank you for pointing that out. What do you do for a living? Are you interested in work? I have a couple of Ignition projects I would be interested in hiring someone to create for me.

Roger E. Henley II

VP Engineering & Technology

Whiskey House

rhenley@whiskeyhouse.com

304-932-8706

2 Likes