BLACK FRIDAY SALE – Unlock Up to 25% OFF on All Exam Prep! - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

The SecOps Group CAP Exam - Topic 12 Question 113 Discussion

Posted by Johnna on Aug 18, 2026 at 06:14 PM

Under the same-origin policy (also SOP), a web browser permits scripts contained in a web page to access data in another web page, but only if both web pages have the same origin. Which of the following pages are in the same origin as that of the below URL?

http://www.example.com/dir/page2.html

http://www.example.com/dir/other.html

http://www.example.com:81/dir/other.html

http://www.example.com/dir/other.html

http://en.example.com/dir/other.html

Suggested Answer: A

The Same-Origin Policy (SOP) is a fundamental security mechanism in web browsers that restricts how a document or script loaded from one origin can interact with resources from another origin. An origin is defined by the combination of protocol, host, and port. Two pages have the same origin if their protocol (e.g., http://), host (e.g., www.example.com), and port (default is 80 for HTTP) match exactly. The given URL is http://www.example.com/dir/page2.html, which uses HTTP, host www.example.com, and the default port 80.

Option 1 ('http://www.example.com/dir/other.html'): Matches the protocol (http), host (www.example.com), and port (default 80), so it is in the same origin.

Option 2 ('http://www.example.com:81/dir/other.html'): Differs in port (81 vs. default 80), so it is a different origin.

Option 3 ('http://www.example.com/dir/other.html'): Identical to Option 1, matching protocol, host, and port, so it is in the same origin. However, since it's a duplicate of Option 1 in the list, it doesn't add a new page.

Option 4 ('http://en.example.com/dir/other.html'): Differs in host (en.example.com vs. www.example.com), so it is a different origin.

Since the question asks which pages are in the same origin, and only Option 1 (and its duplicate Option 3) matches, the correct answer is A ('1 Only'), considering unique pages. The CAP syllabus covers SOP under 'Client-Side Security' and 'Cross-Origin Resource Sharing (CORS).'


Get Premium CAP Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
21 comments · newest first
CR
Cristen 1 day ago
I’m with B) 1 and 2. They share the same path and domain!
ED
Edison 7 days ago
I think D) None of the above is correct. The subdomain changes everything.
GI
Gilberto 12 days ago
I feel like it’s A) 1 Only. Only the exact match counts.
WE
Wenona 17 days ago
I’m leaning towards C) 1, 3 and 4. The port change is confusing though.
SI
Sina 22 days ago
I agree, B makes sense. Same origin means same protocol and domain.
DE
Delsie 27 days ago
This question is tricky! I think it's B) 1 and 2.
EL
Elinore 1 month ago
I lean towards B too. It's straightforward!
JO
Joni 1 month ago
I feel like D) None of the above is too extreme.
DE
Deandrea 1 month ago
True, but 1 and 4 are definitely the same origin.
CH
Chandra 2 months ago
But what about C) 1, 3 and 4? The port is different in 3.
AI
Aimee 2 months ago
Agreed! Same protocol and domain.
TE
Tequila 2 months ago
I think it's B) 1 and 2. They match the origin.
AN
Annabelle 2 months ago
No way, I thought all those were fine!
ME
Meaghan 2 months ago
I thought subdomains counted as different origins?
ME
Mendy 2 months ago
Wait, is 3 really not the same? The port is different!
NO
Novella 3 months ago
Definitely B) 1 and 2!
EL
Elenora 3 months ago
Same origin means same protocol, host, and port!
FL
Fletcher 3 months ago
I feel like option 4 is also the same origin since the path is the same, but I'm not completely confident about the subdomain in option 5.
DE
Denise 3 months ago
I practiced a similar question where we had to identify same-origin URLs, and I think it was just the first two that matched here.
LI
Lili 3 months ago
I'm a bit unsure about option 3 since it has a different port. Does that mean it's not the same origin?
JE
Jeanice 3 months ago
I remember that the same-origin policy is all about matching the protocol, domain, and port. So, I think options 1 and 2 are definitely the same origin.
0/2000 characters

Save Cancel