Web Development



Question about displaying an existing Javascript popup on a HTML

By intrikate01 ·
i made a html version of a game on a mobile device so that its playable on the computer. On the mobile device however, if you click on something, a javascript popup appears to confirm your action or cancel your action.

i have not been able to get that to appear on the computer version since the html doesn't have javascript on it.

if i am making any sense here, what i really want to do is make that same pop up appear on the computer version the same way it does on the mobile device.

the javascript looks something like this when i click inspect element:

the number "90745e413594c7530da46274534c7c1e09b37b9b" also changes per session. so what i am trying to go for is something that points to that javascript and make it pop up and be seen.


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

You need the on-click event for the javascript.

by seanferd In reply to Question about displaying ...

Maybe it needs to be changed since you changed the UI from whatever to HTML-based.

If you understand the javascript engine for the game, modifying this to behave properly shouldn't be a problem.

My guess: You are trying to do things in HTML which can't be done in HTML.

In order to get a better answer than this, you will need to understand what it is you are working with, and also be a lot more specific in your question, like referring to actual code.

Collapse -

on-click event is probably what i need.

by intrikate01 In reply to You need the on-click eve ...

well to be more specific... the mobile device game is actually HTML based but uses a built in browser to load the game inside that application. thats why it was easy for me to make it playable on the computer.

however some aspects of it require javascript stuff like selling equipments where a popup is implemented to prevent the user from accidentally selling equipment. in order for them to do so they would need to press the confirm or cancel button displayed on the popup.

basically i have the html aspect of it down and its just lacking the javascript part - so whenever there should be a javascript popup, my browser instead reloads back to the home page of the game.

i wouldn't know what code to refer to. but if i understand what you are trying to say, should i implement an on-click event listener to listen for that javascript code and display it? i only know a bit about javascript and the way it works but i'm not sure where to start if i was to implement something like that onto my html.

in addition, my html only points to the game. all the real coding for the game and the UI and everything is server-side. this is an online community game so the javascript popup is implemented in different areas such as selling equipments, removing group members, deleting comments etc... so my on-click event would have to be able to display any popup that should appear.

im sorry if this reply is so long. let me know if i am not making any sense. i know without a code to refer to and work with, my question might seem kinda vague but i do hope i explained it well enough

Collapse -

What I would do, then

by seanferd In reply to on-click event is probabl ...

is capture the local source (HTML, javascript, etc.) for the game from the browser cache or saving the page and look through this to see what is being called. Most of this stuff actually runs locally, with the server just processing data and kicking back the results.

Since you are looking for a specific code reference, this is about the only way to do this, aside from contacting the original developers and asking.

If the javascript file(s) are associated with the HTML file(s) the same way they are for the original game, this should all be covered, and the javascript will capture the events.

Caveat: If there is code involved which is specific to mobile devices somehow, you may have to re-write that code.

Collapse -

is there a way...

by intrikate01 In reply to What I would do, then

is there a way to make an on click event which will listen for any javascript popup and display it? if that makes any sense?

can you give me an idea of how to make the javascript popup appear? i've captured the local source but what do i look for exactly?

the local source shows me that the javascript is stored on the server and the html refers to it through:

<script type < script type="text/javascript" src="/script">http://example.com/nw/js/equipment.js?v=210"></script >

and then further down, it has something like this:

< a h r e f ="javascript:sellEquipmentDialog('/equipment.php', 1, 1, 'Katana Sword', 1, 'ef3939cd57fc6da49f23a26518e33d502da17ff9', 'sell')">

where the code inside the brackets () refer to the javascript function sellEquipmentDialog which is on the script stored on the server.

that function sellEquipmentDialog looks like this:

function sellEquipmentDialog(url, itemId, catId, itemName, itemNumber, nonce, sellText) {
var urlJoiner = "%26";
if (url.indexOf('?') == -1 && url.indexOf('%3F') == -1) {
urlJoiner = "%3F";
url = escape(url) + urlJoiner + "action%3Dsell%26iid%3D" + itemId + "%26cat%3D" + catId +
"%26formNonce%3D" + nonce;

var title = "&invokeAlertTwoBtnTitle=Do%20you%20really%20wish%20to%20" +
sellText + "%0D%0A" + itemNumber + "%20" + itemName + "%3F";
var body = "&invokeAlertTwoBtnBody=";
var cancel = "&invokeAlertTwoBtn1Name=Cancel";
var confirm = "&invokeAlertTwoBtn2Name=Confirm";
var cancelJS = "&invokeAlertTwoBtn1JS=return%20false%3B";
var confirmJS = "&invokeAlertTwoBtn2JS=window.location.href%3D%22" + url +
window.location.href = "objectiveC.php?stopLoad=true" + title + body +
cancel + confirm + confirmJS + cancelJS;

and that right there is the popup i really want to display but i don't have a clue how to. so how would i go about with this?

Related Discussions

Related Forums