How do I check if url match

Get help using Construct 2

Post » Sun Aug 17, 2014 8:02 am

hi to all, i would like to know how to do this:

i have an extenrnal file txt, who contains a list of urls, in my app i added ajax and browser object, how to say, when the url match to one of thoses inside the file.txt, then web browser redirect to a special site?

thanks ;)
B
37
S
15
G
7
Posts: 1,681
Reputation: 9,614

Post » Sun Aug 17, 2014 8:36 am

What do you mean by "when the url match to one of thoses inside the file.txt" ?

How are you planning to check that?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Aug 17, 2014 8:41 am

maybe with the list object?
B
37
S
15
G
7
Posts: 1,681
Reputation: 9,614

Post » Sun Aug 17, 2014 8:46 am

Question is..

You say the url has to match, so I guess you want to compare the url to something else?
How are you trying to compare the url?

Through Ajax you can import the textfile and use it in Construct2, then you can use (part of) it, but to know what method would be best for you it would be nice to know how you want to use the information in the text..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Aug 17, 2014 8:52 am

thanks, this is what i have at the moment:

a file.txt who contain:

http://url1.com/
http://url2.com/
etc...

what i want is, when the browser run, if the url typed by the user, match to one on those inside the file.txt, then it redirect to a specific url
B
37
S
15
G
7
Posts: 1,681
Reputation: 9,614

Post » Sun Aug 17, 2014 9:02 am

You could use:

find(src, text)

where src would be Ajax.lastdata and text would be the user typed url..

System compare: find(src, text) is not equal to -1 - means the user typed url exists within the text..

trouble would be that also a half entered url would count as being in the text..

So I guess putting your Ajax.lastdata into an array and looping through that to see if it exists would be better..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Aug 17, 2014 9:58 am

i was thinking if its possible to make a chrome extension with construct2, isaw its possible to make apps "games" for the webstore, it has to be possible too, to make chrome extensions,
i need to make a chrome extension, and at the moment im stuck, because my extension has just one function, it blocks millions of urls updated every week, at the moment my file who contains thes urls is up to 5mb and i need to store that on a server :s
B
37
S
15
G
7
Posts: 1,681
Reputation: 9,614

Post » Sun Aug 17, 2014 10:04 am

I don't think C2 would be the best option for creating something like that..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Aug 17, 2014 10:11 am

Doesn't this program do exactly what you'd like to do?

https://chrome.google.com/webstore/deta ... fdeojpcgbh
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Aug 17, 2014 10:19 am

no, i know, i was watching all the concurrent products, my extension is fully automated, the user install it, and thats it, it blocks the urls i add to the database, the user has just to click "one time" and its done
B
37
S
15
G
7
Posts: 1,681
Reputation: 9,614

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000, Jackriduk, NN81 and 37 guests